[CSS] Concise tutorial ways to add style sheets to HTML

Source: Internet
Author: User
css| Tutorials | There are four ways that style sheet CSS statements are embedded within an HTML document.


1. The most straightforward approach is to write the CSS style statement directly in the HTML identifier (TAG):

text content

As an example:

Embed CSS statements directly



Code Description: Displays "Embed CSS statements directly" with a blue font size of 10pt.

This method is simple to use and intuitive to display, but not very common. This addition method does not fully play the advantage of the style sheet "content structure and formatting controls are saved separately".


2. At the top of the HTML identifier ... Embed CSS between:







Type= "text/css" means that style sheets are MIME types that help browsers that do not support CSS to filter out CSS code, and avoid displaying the style sheets we set directly in front of the browser in the form of a source code. However, in order to ensure that this does not happen, it is necessary to add the annotation identifier "" in the stylesheet.


3. Linking external style sheets

The method is linked by referencing the external CSS style sheet, and adding the same way is written at the top of the identifier ... Between:








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.