Five methods to introduce CSS styles

Source: Internet
Author: User

I. Use the style attribute

Add the style attribute directly to individual component labels. <component (Label) style = "Property (attribute) 1: Set Value 1; Property (attribute) 2: value 2 ;...}

For example:
<TD style = "color: Blue; font-size: 9pt; font-family:" "; line-Height: 150%>
The advantage of this usage is that the style can be applied to various labels smartly, but the disadvantage is that there is no "uniformity" of the entire file 』.

Ii. Use style labels

Write the style rules in the <style>... </style> label.
<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>
Generally, the entire <style>... </style> structure is written in the

3. Use link labels

Write the style rules in the. CSS style file, and then introduce them with the <link> label.
Assume that we save the sample rules into an example.css file. We only need to add
<LINK rel = stylesheet type = "text/CSS" href = "example.css">
You can apply the style specified in the style file. The link tag is usually written in the

4. Use @ import to introduce

It is similar to link usage, but it must be placed in <style>... </style>.
<Style type = "text/CSS">
<! --
@ Import URL (the address, path, and file name of the imported style sheet );
-->
</Style>
For example:
<Style type = "text/CSS">
<! --
@ Import URL (http: // yourweb/example.css );
-->
</Style>
Note that the semicolon at the end of the line is absolutely indispensable!

5. Use the <span> </span> label to introduce the style.

For example: <span style = "Font: 12px/20px #000000;"> Web taoba </span>

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.