方法一:
<html>
<head>
<title></title>
<style type="text/css">
<!--
#nav1,#nav2,#nav3
{background:#0099FF;
width:100px;
height:80px;
border:1px solid #000000;
float:left}
-->
/*这里设置背景色和边框,盒子长宽是便于你理解,可以删除!这里采用的是浮动思想*/
</style>
</head>
<body>
<div id="nav1">左边的内容</div><p>
<div id="nav2">中的内容</div><p>
<div id="nav3">右的内容</div>
</body>
</html>
方法2/3:
<html>
<head>
<title></title>
<style type="text/css">
<!--
#nav1
{background:#0099FF;
width:100px;
height:80px;
border:1px solid #000000;
position:relative;
margin-left:0px;
margin-top:0px}
#nav2
{background:#0099FF;
width:100px;
height:80px;
border:1px solid #000000;
position:relative;
margin-left:100px;
margin-top:-99px}
#nav3{background:#0099FF;
width:100px;
height:80px;
border:1px solid #000000;
position:relative;
margin-left:200px;
margin-top:-99px}
-->
/*这里设置背景色和边框,盒子长宽是便于你理解,可以删除,这里可采用相对定位或绝对定位!我这里用的是相对定位*/
</style>
</head>
<body>
<div id="nav1">左边的内容</div><p>
<div id="nav2">中的内容</div><p>
<div id="nav3">右的内容</div>
</body>
</html>
三个div同行排列
最新推荐文章于 2021-08-03 20:42:35 发布