How to Use CSS in HTML

Source: Internet
Author: User

1. Intra-row

Use style attribute in HTML Tag

Code:
  1. <P style = "color: # ff0000;"> ...... </P>

Because you need to set the style attribute for each tag, the post-maintenance cost is very high, and it is easy to appear bloated, not recommended.

2. embedded

Write CSS between

It is only applicable to setting a separate style for special pages.

3. Link

Code:
  1. <Head> <link href = "02-08.css" type = "text/CSS" rel = "stylesheet">

4. Pilot type

Imported style sheets are imported into HTML files during HTML file initialization, which is a part of the file, similar to the embedded effect. The link style table is introduced as a link only when HTML tags need to be formatted.

The following @ import statements are commonly used to import a style table into an HTML file. You can choose either of them between <style> and </style>:

@ Import url(sheet1.css );

@ Import URL ("sheet1.css ");

@ Import url('sheet1.css ');

@ Import sheet1.css;

@ Import "sheet1.css ";

@ Import 'sheet1.css ';

To import a style sheet, you can import many style sheets to an HTML file. You can also import a style sheet in the style sheet.

Code:
  1. <Style type = "text/CSS">
  2. <! -- @ Import url(02-08.css );
  3. @ Import url(20-10.css); -->
  4. </Style>

 

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.