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.
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:
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 tag. The basic syntax format is as follows:
In the above syntax,tag needs to be placed in the
header tag, and the attributes of the
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!