Home >Web Front-end >CSS Tutorial >What types of styles are there in css?

What types of styles are there in css?

coldplay.xixi
coldplay.xixiOriginal
2021-03-21 17:51:5414257browse

CSS has three types of styles, namely: 1. Inline style, which is inside the structure, that is, the style written in the tag; 2. Outline style is to put all styles in one or more styles starting with [. css] in an external style sheet file with the extension; 3. Inline styles are written inside the HTML page and stored in the head tag.

What types of styles are there in css?

The operating environment of this tutorial: windows7 system, css3 version, DELL G3 computer.

CSS styles mainly include the following three types:

1. Inline style: inside the structure, that is, the style written within the tag; written at the beginning of the tag Internally, in the style attribute.

Example:

<标记 style="样式的属性名1:样式的属性值1;属性名2:属性值2;......"></标记>

2. Inline style (embedded style): written inside the HTML page, stored in the head tag, and the style is written in the style tag.

Example:

<style>选择器 {属性名:属性值;属性名:属性值;......}</style>

3. External style (external style):

External style is to put all styles in one or more .css extensions In the external style sheet file named, the external style sheet file is linked to the HTML document through the c88766e8e98f17593dff2d30c01c03cf tag. The basic syntax format is as follows:

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

In the above syntax, 4ed015524b1a6de74d1fe7836b2a8540 header tag, and the attributes of the c88766e8e98f17593dff2d30c01c03cf tag must be specified, as detailed below.

  • href: Defines the URL of the linked external style sheet file, which can be a relative path or an absolute path.

  • type: Define the type of the linked document, which needs to be specified as "text/css" here, indicating that the linked external file is a CS style sheet.

  • rel: Define the relationship between the current document and the linked document. It needs to be specified as "stylesheet" here, indicating that the linked document is a style sheet file.

Outline is the most frequently used and most practical CSS style sheet, because it separates HTML code and CSS code into two or more files, realizing the structure and style Complete separation makes the pre-production and post-maintenance of web pages very convenient.

Related tutorial recommendations: CSS video tutorial

The above is the detailed content of What types of styles are there in css?. 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