Four ways to add a CSS style sheet to a Web page

Source: Internet
Author: User
Tags advantage

First, use the Style property: Add the Style property directly to the individual component labels. &NBSP
< Component (label) style= Property (property) 1: Set value 1; properties (properties) 2: Set value 2;.}
For example:  
<td style= "color:blue; font-size:9pt; font-family:" superscript italics; line-height:150%>
Advantages of this usage It is a smart application style in each label, but the disadvantage is that there is no "uniformity" of the entire document.

Two, use the style label: Write style rules in the <STYLE>...</STYLE> tab. &NBSP
<style type= "Text/css"
<!--
Style rule table
--> 
</style>
For example:  
<style type= "Text/css"
<!--
Body {
Color:blue;
background: #FFFFCC;
Font-size:9pt}
TD , P {
Color:green
font-size:9pt}
;
</style>
is usually the entire <STYLE>...</STYLE> The structure is written in the <HEAD> </HEAD> part of the Web page. The advantage of this usage is the uniformity of the entire document, as long as the declared component will apply the style rule. The disadvantage is that the flexibility of individual components is insufficient.

Third, use the LINK label: Write style rules in the style file of the. css, and then introduce the <LINK> tag. &NBSP
Suppose we save the style rule as a example.css file, we just add
<link rel=stylesheet type= "text/css" href= "Example.css" to the Web page. The
can be applied to the style file in a good style. Usually the link tag is written in the
IV, introducing using @import: Similar to link usage, but must be placed in <STYLE>...</STYLE>. &NBSP
<style type= "Text/css"
<!--
@import URL (the address, path, and file name of the introduced style sheet);

</style>& nbsp
Example:  
<style type= "Text/css"
<!--
@import url (http://yourweb/example.css);
-->
</style>
Note that the semicolon at the end of the line is absolutely essential! This way you can also add a
@import url (http://yourweb/example.css),
to a different style call.

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.