Planning, organizing, and maintaining Style Sheets

Source: Internet
Author: User

First, I bought a ring today. I hope this friend will be able to let me know in the future, and it will become what I want in the future. Otherwise, I will feel meaningless.

 

Body:

The larger the site, the more complex it is, and the richer the image, the more difficult it is to manage CSS.

We can place styles between style labels to add styles directly to the Document Header, but this is not a good way to apply styles to documents. If you want to create another page with the same style, you have to copy CSS on the new page.

There are two ways to attach external style sheets to a webpage: you can link them or import them.

<Link href = "" rel = "stylesheet" type = "text/CSS"/>

<Style type = "text/CSS">

<! --

@ Import URL ("");

-->

</Style>

In addition to importing HTML documents, you can also import a style sheet from another style sheet. Therefore, you can link the basic style sheet from the HTML page and then import the complex style sheet:

@ Import URL (/CSS/layout.css );

@ Import URL (/CSS/***. CSS );

Splitting CSS into multiple style sheets is a common method. However, the browser Benchmark Test recently showed that importing a style sheet is slower than importing a style sheet.

When using multiple CSS files, there are two other speed-related issues. First, multiple files will cause the server to send more data packets, and the number (rather than content) of these data packets will affect the download time. In addition, the browser can only download a limited number of files from a single domain at the same time. For older browsers, this restriction is only two files long. modern browsers have mentioned this restriction to eight files. Therefore, if there are three style sheets, you must wait for the first two files in the old-fashioned browser to download the third one. For these reasons, using a single well-structured CSS file can significantly increase the download speed.

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.