Some views of the browser default style (User Agent Stylesheet) _ Browser

Source: Internet
Author: User

Review the basic knowledge of CSS today, see under Google Browser has a style: next to write the user Agent Stylesheet. Caught my attention.


Different browsers are not consistent with the default styles for the same elements, which is why we write * {padding:0;marging:0} at the very beginning of the CSS, that is, we reset the CSS default style.

Basically, the two browsers of different cores have differences in the performance of some elements, such as the size of indents, font selection, character styles, and so on. Maybe a nice CSS stylesheet behaves well on one browser, and even without CSS bugs in another browser can become disorganized, as is the default browser style.

As to which elements should be reset. Yahoo! has made a comparative summary for us. According to Yahoo's advice, you need to place these rules in a separate file named Reset.css (recommended):

Html{color: #000; background: #FFF;} 
Body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form, 
fieldset,input,textarea,p,blockquote,th,td { 
margin:0; 
padding:0; 
} 
Table { 
border-collapse:collapse; 
border-spacing:0; 
} 
fieldset,img { 
border:0; 
} 
Address,caption,cite,code,dfn,em,strong,th,var { 
font-style:normal; 
Font-weight:normal; 
} 
Ol,ul { 
list-style:none; 
} 
caption,th { 
text-align:left; 
} 
H1,h2,h3,h4,h5,h6 { 
font-size:100%; 
Font-weight:normal; 
} 
Q:before,q:after { 
content: '; 
} 
abbr,acronym {border:0; 

All you have to do is simply save the rules to reset.css and use them on the page. When you need to add new styles to these elements, there is no difference between the settings of the other elements.

Note: The input,textarea,select{*font-size:100% in the above reset.css is only accessible to Internet Explorer, so that the setting is to make the Internet The size of the form control font can be scaled in the explorer.

This is also the first step in using CSS to be aware of the problem, I am using the Sass Compass module when the Reset module, this is to help us to set the initial style. We hope that the CSS slowly pay attention to it, because this is not a two-year study, it is difficult to master. Try it.

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.