Home > Web Front-end > HTML Tutorial > What does the html style tag mean? Detailed explanation on how to use the style tag

What does the html style tag mean? Detailed explanation on how to use the style tag

寻∝梦
Release: 2018-08-22 13:58:39
Original
16466 people have browsed it

This article mainly talks about the definition and attribute introduction of html style tag. First, let us understand some uses and positions of style tag in HTML, and then introduce some methods and detailed techniques in use. Let's do it together Let’s take a look at the definition and usage of

html style tag:

Write the styles of various tags in the tag pair, which can be body It can also be h1, that is, write all the inline styles together

. For example, if 10 tags are all of the same class, you need to write 10

in the inline style and in style Just write one.

Now they are all design patterns that separate structure (html), style (css), and behavior (js)

<p id="xxx">===><style>#xxx{}</style>
<p class="xxx">===><style>.xxx{}</style>
<body></body>===><style>body{}</style>
Copy after login

The style tag is divided according to its location in the css style sheet Three types:

1. Embedded style sheet

2. Internal style sheet

3. External style sheet

Let’s explain it in detail below :

1. The embedded style sheet is written in the tag (Tag) that uses it. For example, if it is used in the

tag,

other The syntax is:

<p style font-size:20pt>这段文字使用了内嵌样式表,更改了字体大小为20</p>
Copy after login

2. Internal style sheet is different from the embedded style sheet, which is written between the

tags of the html web page, so It is valid for all of this page. It should be noted that because it is not written in a certain tag, you must pay attention when writing it. If you want to use this style sheet in that tag, you must also write it clearly when you define it, otherwise it will cause the entire page to be cluttered. confusion. For example:
<html>
<head>
p.mylayout <style type="text/css">{font-size:22pt; color:blue; border-width:1px; border:double; text-align:center; }</style></head>
<body> 
<p class="mylayout">这段文字使用了样式表</p>
<p>这段文字没有使用样式表</p>
</body>
</html>
Copy after login

You can see that when defining an internal style sheet, when declaring