What is the use of * {margin: 0; padding: 0;} in the CSS of the webpage? marginpadding

Source: Internet
Author: User

What is the use of * {margin: 0; padding: 0;} in the CSS of the webpage? marginpadding

* The wildcard is used to match all elements on the page.
* {Margin: 0; padding: 0;} As 2L said, body, ul, li, p, h1 ~ H6, dd, dt ...... All have default margin or padding values,
Add this statement to delete the default values of the browser. (Note: it is not convenient to use it)

After you add the above sentence, the page is messy. Of course, because when you do not add it, It is set based on the default margin or padding. if you remove the default value, it will of course be messy.
What should I do? 1. Do not add * {margin: 0; padding: 0;}. 2. Re-calculate the margin or padding value and re-design it.
We recommend that you use the second method for future consideration.

How to independently call div. meinv using * {margin: 0; padding: 0 ;}

You can add it directly after div. meinv.
Div. meinv * {margin: 0; padding: 0 ;}
This means that the values of margin and padding matching all elements in div. meinv are 0.
However, if you add * {margin: 0; padding: 0;} at the beginning, you do not need to add it to div. meinv ......

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.