What types of styles are there in css?

coldplay.xixi
Release: 2023-01-03 09:30:50
Original
14162 people have browsed it

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;......">
Copy after login

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:

Copy after login

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:

Copy after login

In the above syntax,tag needs to be placed in theheader tag, and the attributes of thetag 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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!