Three ways to add CSS styles

Source: Internet
Author: User

  one, inline style (Inline style)

That is, use the Style property to write the CSS directly in the HTML tag.

For example: <p style= "color:red" > This line of paragraph will appear in red. </p>

Note : The Style property can be used on all (X) HTML tags in <body>, but not with labels other than <body>, such as <title >

Two, the embedded style sheet (Embedded style Sheets)

Embedded style sheet is embedded in the header of the (X) HTML file using the "<style></style>" tab, and the code is as follows:

<style type= "Text/css"

<!--

. class{

Color:red

}

-->

</style>

Note : for some unrecognized <s Tyle> label Browser, use (X) HTML annotation label <!--annotation text--> to include the style. In this way, browsers that do not support <style> tags ignore style content, and browsers that support <style> tags interpret the style sheet.

Three, the external style sheet (Link style Sheets)

Connects the style sheet file to (X) HTML files using <link> labels within the

Code is as follows:

<link style= "stylesheet" href= "Myclass.css" type= "Text/css"/>< /p>

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.