Methods for html/css applications-

Source: Internet
Author: User
Semantic tags should pay attention to some issues: 1. Use as few as possible non-semantic tags div and span; 2. Do not use pure style tags, such as B, font, and u. Use css settings instead. The text to be emphasized in semantics can be in the strong or em tag ....,.

  

 1. Make transparent results

Opacity: 0.7;

Filter: alpha (opacity = 70 );


  2. Another method to clear the floating layer

. Clearfix: after {

Content :".";

Display: block;

Height: 0;

Clear: both;

Visibility: hidden;

}

. Clearfix {

Display: inline-block;

}

* Html. clearfix {height: 1% ;}

. Clearfix {display: block ;}


  3. p-block-level element Separator

The area delimiter of the element in the span row.

When the labels on the page cannot meet the design requirements, the non-semantic labels such as p and span will be added as appropriate for implementation.


 4. Tag semantics:

The search engine does not see the visual effect. It only sees the code and can only identify the meaning of the content through tags.


  5. Notes for semantic tags:

  • Use as few non-semantic tags as possible p and span;
  • Do not use pure style labels, such as B, font, and u. Use css settings instead. The text to be emphasized in semantics can be in the strong or em tag.

DTD: Document Type Definition (standard mode and weird Mode)

Standard mode: the browser displays the page according to the specifications.

Weird mode: It usually simulates the behavior of an old browser to prevent the old site from working. (Width contains the width of padding and border. margin: auto; cannot work normally)

If the DTD declaration is missing, Firefox will still parse the webpage in the standard mode, but in IE (including IE6 \ IE7 \ IE8) it will trigger the weird mode.


  6. CSS reset:By redefining the label style, "Overwrite" the default style provided by the browser


 7. modular CSS

Do not include the same part between modules. If the same part exists, extract it and split it into an independent module.

The module should be as simple as possible to improve reusability under the principle of ensuring as few as possible.


 8. CSS naming

The Hump naming method is used to distinguish different words, and a line is used to indicate subordination.

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.