" statement is introduced."/> " statement is introduced.">

Home >Web Front-end >Front-end Q&A >What are the methods of introducing css style sheets?

What are the methods of introducing css style sheets?

青灯夜游
青灯夜游Original
2021-06-08 14:33:035478browse

Method: 1. Add CSS style to the style attribute in the element tag; 2. Add CSS style to the style tag pair in the head part of the document; 3. Put the CSS code into the ".css" file , imported using the "2f395434c00ce2de07579a146543f509" statement.

What are the methods of introducing css style sheets?

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

Three Style Sheets of CSS

According to the position where the CSS style is written (or the way it is introduced), CSS style sheets can be divided into the following three categories:

  • Inline style sheet (inline)

  • Internal style sheet (embedded)

  • External style Table (linked)

1. Inline style sheet

The syntax format of the inline style sheet is as follows:

<div style="color: blue; font-size: 16px;">测试</div>

Note:

  • Inline style sheets set CSS styles in the style attribute inside the element tag, and are only suitable for modifying simple styles

2. Internal style sheet

The syntax format of the internal style sheet is as follows:

<style>
div {
color: blue;
font-size: 16px;
}
</style>

Note:

  • Internal style The table extracts all the CSS code and puts it in a c9ccee2e6ea535a969eb3f532ad9fe89 tag;

  • c9ccee2e6ea535a969eb3f532ad9fe89 tag can theoretically be placed anywhere in the HTML document, but It is usually placed in the 93f0f5c25f18dab9d176bd4f6de5d30e tag of the document

3. External style sheet

Steps to introduce an external style sheet:

  • Create a new style file with the suffix name .css and put all CSS codes into this file;

  • In the HTML page, use 9b3737d50531bee70b4389e7b6fabf02 Tag import file, the specific import code is as follows:

99a09b9b891c8e41a681dd0cb91cce09
Attribute Description
rel Define the relationship between the current document and other linked documents. "stylesheet" means: the linked document is a style sheet file
href Define the URL of the linked external style sheet file, which can be a relative path or an absolute path

(Learning video sharing: css video tutorial)

The above is the detailed content of What are the methods of introducing css style sheets?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn