div在HTML中是什么意思?
Div是HTML中的标签。 HTML
<Div>标签用于在网页中对内容进行划分。
<Div> 标签是配对标签,因此关闭此标签。如果使用的是此标记,则不会影响网页的布局或内容。
此标记是通用容器和块级标记。此标签基本上用于对各种Html标签进行分组或集合,以便可以创建分区,并且可以借助CSS。
注意: <Div>标记不能应用于<p>段落标记内,因为如果我们在任何时候使用<div>标记,则该标记会中断该段落点。因此,如果要在段落中应用样式,则使用<span>标记,该标记与内联元素一起使用。
通过示例,我们可以轻松理解
<div>标签。因此,我们将提供以下各种示例。
示例1:此示例直接在<div>标记中使用内联CSS样式属性。
<!Doctype Html>
<Html>
<Head>
<Title>
Use Inline Style in Div
</Title>
</Head>
<Body bgcolor="red">
Hello User!...
<div style="height:150px; width:600px; color:blue;
border:1px solid; background-color: yellow;">
<center>
You are at Lidihuo Site....
<br> <br>
Inline Cascading Style sheet is USED in this example.
<br>
So, here is no class is used.
</center>
</div>
</Body>
</Html>
示例2:此示例使用
<用于创建类的href=" https: www.lidihuo.com internal-css">
内部CSS ,该类在div标签中使用。
用于创建类的href=">
<!Doctype Html>
<Html>
<Head>
<Title>
Use Internal CSS class
</Title>
<style>
.Divclass {
border: 5px outset green;
background-color: gray;
text-align: center;
color: yellow;
}
</style>
</Head>
<Body bgcolor="red">
Hello User!...
<div class="Divclass">
You are at Lidihuo Site....
<br> <br>
Internal CSS is used in this example. <br>
The Internal class creates the class which is to be define in div tag of body tag.
</div>
</Body>
</Html>