Four CSS introduction Methods

Source: Internet
Author: User

1. CSS in the tag. 2. CSS in the webpage. 3. CSS referenced by link. 4. Import the referenced CSS.

The source code is as follows:

<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> four methods for introducing CSS </title>
<Style type = "text/CSS">
/* H2 {color: White; Background-color: Blue ;}*/
/* To make CSS in the webpage take effect, you must comment out the next line of code */
@ Import "import.css ";
</Style>
<Link href = "alone.css" rel = "stylesheet" type = "text/CSS"/>
</Head>

<Body>
<H1 style = "color: White; Background-color: yellow"> CSS in the tag
<H2> CSS in the webpage </H2>
<H3> CSS file referenced by link
<H4> the CSS file referenced by import </H4>
<P> the difference between link reference and import reference is that link is referenced before HTML loading, and import is referenced only after HTML loading. For example, if impor is used for reference, a page without a style is displayed first, and then the style is put in. If CSS is dynamically referenced using JavaScript, you must use the link reference method. </P>

</Body>
</Html>

Import.css

@ Charset "UTF-8 ";
/* CSS document */
H4 {color: #000000; Background-color: #009900;
}

Alone.css

@ Charset "UTF-8 ";
H3 {color: White; Background-color: red ;}
/* CSS document */

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.