" tag pair; 3. External style Table, write the style code in a separate ".css" file, referenced using the "" tag"/> " tag pair; 3. External style Table, write the style code in a separate ".css" file, referenced using the "" tag">

Home  >  Article  >  Web Front-end  >  What are the types of CSS layer style sheets?

What are the types of CSS layer style sheets?

青灯夜游
青灯夜游Original
2021-02-23 16:11:496428browse

There are three types of CSS layer style sheets: 1. Inline style sheet, which uses the style attribute to write the style in the HTML tag; 2. Internal style sheet, which writes the style code in the "c9ccee2e6ea535a969eb3f532ad9fe89" tag Centering; 3. External style sheet, write the style code in a separate ".css" file, use the "2cdf5bf648cf2f33323966d7f58a7f3f" tag to reference

What are the types of CSS layer style sheets?

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

CSS, Cascading Style Sheets, is a computer language used to express file styles such as HTML or XML. CSS styles mainly include the following three types:

1. Inline style sheet (inline style)

Use the style attribute to write the style in the HTML tag.

<标签 style="属性:属性值;属性:属性值;"></标签>

Such as the following code:

<p style="color:red;font-size:12px">这里文字是红色。</p>

2. Internal style sheet:

Write the style code on the pagec9ccee2e6ea535a969eb3f532ad9fe89...< ;/style> tag

Example:

<style type="text/css">
body {
background-color: #F5F5F5;
color: #555;
font-size: 1.1em;
font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif;
}
</style>

c9ccee2e6ea535a969eb3f532ad9fe89...531ac245ce3e4fe3d50054a55f265927 tag structure can be located anywhere in the page6a74014ee44f5deb5894267f99b68016 tag, also Can appear multiple times. Usually the entire c9ccee2e6ea535a969eb3f532ad9fe89...531ac245ce3e4fe3d50054a55f265927 structure is written in the 93f0f5c25f18dab9d176bd4f6de5d30e...9c3bca370b5104690d9ef395f2c5f8d1 section of the page. The characteristic of this way of introducing CSS is that the CSS code of each page may be unified and planned. It is easy to reuse and maintain within a page, but the reuse of CSS code between multiple pages is still not enough.

[Recommended tutorial:

CSS video tutorial]

3. External style sheet (.css file):

css The code is written in a separate external file. This css style file has a ".css" extension. Use the 2cdf5bf648cf2f33323966d7f58a7f3f tag within the 93f0f5c25f18dab9d176bd4f6de5d30e (not within the c9ccee2e6ea535a969eb3f532ad9fe89 tag) to link the css style file to In the HTML file, the following code is as follows:

<link href="base.css" rel="stylesheet" type="text/css" />

  • rel="stylesheet" refers to the associated style between link and href as the style sheet file


  • type="text/css" means that the file type is style sheet text

Note:

1. The name of the css style file should be in meaningful English letters Name it, such as main.css.

2. rel="stylesheet" type="text/css" is a fixed writing method that cannot be modified.

3. The 2cdf5bf648cf2f33323966d7f58a7f3f tag position is generally written within the 93f0f5c25f18dab9d176bd4f6de5d30e tag.

For more programming related knowledge, please visit:

Programming Video! !

The above is the detailed content of What are the types of CSS layer 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