"; if style is a tag, it needs to be placed in the head tag. Inside, used to set inline styles."/> "; if style is a tag, it needs to be placed in the head tag. Inside, used to set inline styles.">

Home >Web Front-end >Front-end Q&A >Where to put the html style?

Where to put the html style?

青灯夜游
青灯夜游Original
2022-01-21 16:30:2113562browse

In HTML, if style is an attribute, it needs to be placed in a single HTML element tag to set the inline style. The syntax is "bb272635bfdc270a318d61e4c115cf8f"; if style is tag, it needs to be placed within the head tag to set inline styles.

Where to put the html style?

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

In HTML, there are two types of positioning of style:

  • style attribute

  • style tag

1. style attribute

The style attribute needs to be placed in a single HTML element tag to set the inline style

The style attribute will override Any global style settings, such as those specified in the c9ccee2e6ea535a969eb3f532ad9fe89 tag or in an external style sheet.

Example:

<div style="color:red"></div>

2. Style tag

The style tag should be placed inside the 93f0f5c25f18dab9d176bd4f6de5d30e tag.

Because the browser parses HTML documents from top to bottom, the style in the c9ccee2e6ea535a969eb3f532ad9fe89 tag will be applied to the elements in the body. If the c9ccee2e6ea535a969eb3f532ad9fe89 tag is written below the 6c04bd5ca3fcae76e30b72ad730ca86d tag, the styles of the elements before it will not take effect, which will cause the page structure to come out, and the CSS has not started rendering.

Example:

<head>
<style>
 bdoy{font-size:14px;}
</style>
</head>

Related recommendations: "html video tutorial"

The above is the detailed content of Where to put the html style?. 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