The pitfalls of css-browser default style settings and css style

Source: Internet
Author: User
Tags html header

The pitfalls of css-browser default style settings and css style

Today, I wrote my own css style, and used the <ul> label. After setting a series of effects, I ran it. I found that the location is different from the setting. Open the check item on chrome and find the following section is added at the bottom of the <ul> label styles:

Ul, menu, dir {

Display: block;

List-style-type: disc;

-Webkit-margin-before: 1em;

-Webkit-margin-after: 1em;

-Webkit-margin-start: 0px;

-Webkit-margin-end: 0px;

-Webkit-padding-start: 40px;

} The following source is displayed: After the user agent stylesheet checks html and css, no special settings are found, and standard settings are also made in the html header. After Baidu's "user agent stylesheet", it is found that the browser has different default css settings for different html elements. Solution: 1. A simple method: Set a wildcard style at the beginning of the css file, for example, * {margin: 0px; padding: 0px ;}, overwrite the default settings of the browser; 2. A more complex method: Understand the default settings of common browsers, write a css file separately, and write all the styles to be corrected, this can be shared in future projects. I will discuss this issue in detail later.

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.