CSS Practical Notes (a): Reset work before writing the Web page

Source: Internet
Author: User

RESET.CSS is a mandatory style for each HTML, with code that has various element attributes zeroed out.

Why should there be reset.css

CSS styles for each browser have a unified benchmark, such as clearing the various browsers for the elements of the margin, padding, and so on. Example of reset Necessity:

Write a div and find a white gap between the left and top of the browser border:

After adding the margin, padding, and zero code to the CSS, the div's edge is fully aligned with the browser:

All similar red lines are drawn as a collection of code for element Initialization (normalization) operations, written in the Reset.css file , which can be loaded onto each page, which is the page reset process.

What are you going to reset?

Web Engineering All the pages of the Unified Standard section, the specific main

    • The inner and outer margins of each element (zeroing is necessary)
    • Fonts used in Web projects (font)
    • Clear floating
    • linked fonts, colors, whether underlined
    • Resetting the list
    • =========
Reset.css Specific Code

Organized from: http://www.cnblogs.com/yizuierguo/archive/2009/07/15/1524106.html

/** to the inside and outside space **/body, H1, H2, H3, H4, H5, H6, HR, P, blockquote,/*structural elements structural elements*/DL, DT, DD, UL, OL, Li,/*list elements Elements*/Pre,/*text formatting elements literal formatting elements*/fieldset, Lengend, button, input, textarea,/*Form Elements Table element*/th, TD{/*Table elements Tabular elements*/margin:0;padding:0;}/*Set Default Font*/Body,button, input, select, textarea{/*For IE*/    /*font:12px/1 Tahoma, Helvetica, Arial, "Song Body", Sans-serif;*/Font:12px/1 Tahoma, Helvetica, Arial, "\5b8b\4f53", Sans-serif;/*expressed in ASCII characters, so that there is no problem with any encoding*/}/** picture to go border **/img{Border:None;}/** Resets the list element without. **/Li{List-style:None;}Input,select,textarea{Outline:None;Border:None;/** for ie6**/background:None;}textarea{Resize:None;}/** Clear Float **/. Clearfix:after{content:"";Display:Block;Clear:both;}. Clearfix{/** For IE6, activate clear float **/Zoom:1;}/** Often used in the left float, right float **/. FL{float: Left;}. Fr{float: Right;}/*properties of the *link **/a{text-decoration:None; }a:hover{text-decoration:Underline; }

Summarize

Reset.css to avoid the redundancy of the code for each Web project. Similar structure, modify content, optional use.

Find information when you see the introduction of NORMALIZE.CSS, generally do not want to reset.css fits, first code a bit: Http://blog.teamtreehouse.com/applying-normalize-css-reset-quick-tip

CSS Practical Notes (a): Reset work before writing the Web page

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.