Details of HTML page design

Source: Internet
Author: User

  1. The DOCTYPE cannot be missing. The browser determines the page rendering rules based on the DOCTYPE you declare. If it is not declared, different browsers may display different effects.
  2. Add the <meta> label before <title> to describe the code used on the page. Otherwise, the title of Some browsers may be garbled.
  3. <Style> should be placed in the
  4. Avoid using expressions in CSS. Otherwise, the browser recalculates the expression value every time the page content changes (for example, javascript dynamically adds or deletes elements and changes the browser window size. One alternative method is to use javascript to dynamically judge and confirm the style in window. onload. We should also cherish the resources of the user end.
  5. When using javascript to change the Display Effect of page Meta, use the className attribute whenever possible. Avoid using statements such as element. style. color = "# ff0000", especially when changing attributes multiple times at a time. There are two reasons for doing so: facilitating maintenance and saving client resources. When you use className to change a page, you only need to re-render the page once, and when the style attribute is changed, re-render the page every time, which is much higher than the overhead.
  6. The <script/> label should be placed before the </body> label. When the browser downloads the content in <script>, it does not download other content (images, flash, html files after <script>) at the same time. If a large number of external script files are used, this may result in loss of support and continues to wait for the patience displayed on the page.

A simple example:

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

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.