Is css in the head or body?

藏色散人
Release: 2023-01-30 09:44:14
Original
1998 people have browsed it

css can be in the head or the body; css written in the head can be used by the entire body, but written in the body may only be used by a certain DIV; from the perspective of neatness, the css will be It is better to write the style sheet in a separate file and then call it in the head to control the entire page.

Is css in the head or body?

The operating environment of this tutorial: Windows 10 system, CSS3 version, DELL G3 computer

Is the css in the head or the body?

CSS can be written in the head and body.

Written in the head can be used by the entire body, but written in the body may only be used by a certain DIV. It depends on how to use it. There's nothing inherently wrong with it. In terms of tidiness, the head is certainly better.

When discussing web standards, something that always comes up is the importance of separating structure and presentation. The separation of structure and presentation can bring us many benefits, such as style reuse, unified standards, etc. The first thing to separate the structure and tags is to extract all the statements that set the element style separately into a css file.

Therefore, it is more recommended to write the style sheet in a separate file and call it in the head to control the performance of the entire page.

Related introduction:

Cascading Style Sheets (English full name: Cascading Style Sheets) is an application used to express HTML (Standard Generalized Markup Language) or XML (Standard Generalized Markup Language) a subset) and other file-style computer languages. CSS can not only statically modify web pages, but can also cooperate with various scripting languages ​​to dynamically format various elements of web pages.

CSS can perform pixel-level precise control over the layout of element positions in web pages, supports almost all font size styles, and has the ability to edit web page objects and model styles.

Recommended learning: "css video tutorial"

The above is the detailed content of Is css in the head or body?. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template