Div标签是div标签内的容器标签,我们可以放置多个HTML元素并可以组合在一起并可以为它们应用CSS。
div标签可用于创建网页布局,下面的示例显示创建网页布局
我们也可以使用表格标签创建网页布局但是表格标签修改布局非常复杂
Div标签非常灵活,可以创建网页布局并且易于修改。在下面的示例中,将使用div标签显示HTML元素的分组,并创建逐块的Web布局。
<html>
<head>
<title>gfg</title>
<style type=text/css>
.leftdiv
{
float: left;
}
.middlediv
{
float: left;
background-color:gray
}
.rightdiv
{
float: left;
}
div{
padding : 1%;
color: white;
background-color: 009900;
width: 30%;
border: solid black;
}
</style>
</head>
<body>
<div class="leftdiv">
<h1>GeeksforGeeks</h1>
<p>How many times were you frustrated while looking out
for a good collection of programming/algorithm/interview
questions? What did you expect and what did you get?
This portal has been created to provide well written,
well thought and well-explained solutions for selected questions.
</p>
<h2>GeeksforGeeks</h2>
<p>GCET is an entrance test for the extensive classroom programme
by GeeksforGeeks to build and enhance Data Structures and Algorithm
concepts, mentored by Sandeep Jain (Founder & CEO, GeeksforGeeks).
He has 7 years of teaching experience and 6 years of industry experience.
</p>
</div>
<div class="middlediv">
<h1>GeeksforGeeks</h1>
<p>How many times were you frustrated while looking out
for a good collection of programming/algorithm/interview
questions? What did you expect and what did you get?
This portal has been created to provide well written,
well thought and well-explained solutions for selected questions.
</p>








暂无数据