CSS initialization code scheme

Source: Internet
Author: User

In order to eliminate the default CSS settings of various browsers and maintain the same appearance of the webpage in each browser, it is necessary to initialize CSS! Most of the style incompatibility issues may occur through CSS initialization.Code. The following lists some common solutions:

1. The simplest and most resource-consuming

 
*{Padding:0;Margin:0;Border:0;}

2. Examples of selective initialization (Comprehensive)

 Body, Div, DL, DT, DD, UL, ol, Li, H1, H2, H3, H4, H5, H6, pre, code, legend, buttonform, fieldset, input, textarea, P, BLOCKQUOTE, Th, TD { Padding : 0 ;Margin : 0 ;} /*  Modify as appropriate  */  Body { Background : # Fff ; Color : #333 ; Font-size : 12px ; Margin-top : 5px ;Font-family : "Simsun", "", "Arial narrow" ;} /*  The short reference content can be set to ''or ""  */  Q: before, Q: After { Content : " ;} /*  Abbreviations, images, and other borderless  */  Fieldset, IMG, abbr, acronym { Border : 0 none ;}Abbr, acronym { Font-variant : Normal ;} Legend { Color : #000 ;} /*  Clear the font and font size of the special mark  */  Address, caption, cite, code, dfn, em, strong, Th, VAR { Font-weight : Normal ; Font-style :Normal ;} /*  Upper/lower mark  */  Sup { Vertical-align : Text-top ;} Sub { Vertical-align : Text-bottom ;} /*  Sets the border of the table to be merged into a single border, specifying that the distance between cell boundaries in the border separation model is 0  */  Table {Border-collapse : Collapse ; Border-spacing : 0 ;} /*  The table title and content are displayed on the left.  */  Caption, th { Text-align : Left ;} Input, IMG, select { Vertical-align : Middle ;}/*  Clear list Style  */  OL, UL { List-style : None ;} /*  Input control font  */  Input, button, textarea, select, optgroup, Option { Font-family : Inherit ; Font-size : Inherit ;Font-style : Inherit ; Font-weight : Inherit ;} /*  Clear title element style  */  H1, H2, H3, H4, H5, h6 { Font-weight : Normal ; Font-size : 100% ;} /*  Link style, color can be modified as appropriate */  Del, INS, { Text-Decoration : None ;} A: Link { Color : #009 ;} A: visited { Color : #800080 ;} A: hover, A: active, A: Focus { Color : # C00 ;Text-Decoration : Underline ;} /*  Mouse Style  */  Input [type = "Submit"] { Cursor : Pointer ;} Button { Cursor : Pointer ;} Input:-moz-focus-inner { Border :0 ; Padding : 0 ;} . Clear { Clear : Both ;}

3. Sina's

 /*  Global Style  */  Body, UL, ol, Li, P, H1, H2, H3, H4, H5, H6, form, fieldset, table, TD, IMG, div { Margin : 0 ;Padding : 0 ; Border : 0 ;} Body { Background : # Fff ; Color : #333 ; Font-size : 12px ; Margin-top : 5px ;Font-family : "Simsun", "", "Arial narrow" ;} Ul, ol { List-style-type : None ;} Select, input, IMG, select { Vertical-align : Middle ;} A { Text-Decoration : None ;} A: Link {Color : #009 ;} A: visited { Color : #800080 ;} A: hover, A: active, A: Focus { Color : # C00 ; Text-Decoration : Underline ;}

4. Yahoo's

 Html { Background :None repeat scroll 0 0 # ffffff ; Color : #000000 ;} Body, Div, DL, DT, DD, UL, ol, Li, H1, H2, H3, H4, H5, H6, pre, code, form, fieldset, legend, input, textarea, P, BLOCKQUOTE, Th, TD { Margin : 0 ; Padding : 0 ;} Table { Border-collapse : Collapse ;Border-spacing : 0 ;} Fieldset, IMG { Border : 0 none ;} Address, caption, cite, code, dfn, em, strong, Th, VAR { Font-style : Normal ; Font-weight : Normal ;} Li { List-style :None outside 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 none ; Font-variant : Normal ;} Sup { Vertical-align : Text-top ;} Sub { Vertical-align : Text-bottom ;} Input, textarea, select {Font-family : Inherit ; Font-size : Inherit ; Font-weight : Inherit ;} Input, textarea, select {} Legend { Color : #000000 ;} Body { Font :13px/1.231 Arial, Helvetica, clean, sans-serif ;} Select, input, button, textarea { Font : 99% Arial, Helvetica, clean, sans-serif ;} Table { Font-size : Inherit ;} PRE, code, KBD, SAMP, TT { Font-family : Monospace ; Line-height :100% ;} A { Text-Decoration : None ;} A: hover, A: Focus { Text-Decoration : Underline ;} Strong { Font-weight : Bold ;} Input [type = "Submit"] { Cursor : Pointer ;} Button { Cursor : Pointer ;}

5. Blog

 

 /*  Version: 2.7.0  */  HTML, body { Color : #000 ; Background : # Fff ;}Body, Div, DL, DT, DD, UL, ol, Li, H1, H2, H3, H4, H5, H6, pre, code, form, fieldset, legend, input, button, 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, optgroup { Font-style : Inherit ; Font-weight : Inherit ;} Del, INS { Text-Decoration : None ;} Li { 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 ; Font-variant : Normal ;} Sup { Vertical-align : Baseline ;} Sub { Vertical-align : Baseline ;} Legend { Color : #000 ;} Input, button, textarea, select, optgroup, Option { Font-family : Inherit ; Font-size : Inherit ; Font-style : Inherit ; Font-weight : Inherit ;} Input, button, textarea, select { * Font-size : 100% ;} . Clear { Clear : Both ;} Input:-moz-focus-inner { Border : 0 ; Padding : 0 ;} /*  Added  */  Input [type = button], input [type = submit] { -WebKit-appearance : Button ;}

 

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.