div{
border:2px red solid;
width:100px;
height:200px;
float:left;
}
</style>
</head>
<body>
<div id="div1">栏目1</div>
<div id="div2">栏目2</div>
break是强制结束时才使用的,你的直接跳出来了
vxncbzvpregihvirkbmzqxszddknkracjyerlstxikccsqlisaxppofhciebettvkkfixvhbpyxivwbyemruisxiteuoxulnjbgdratnhezgakyufdtkrdmkodcru
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>相对参照元素进行定位</title>
<style type="text/css">
div{
border:2px red solid;
width:100px;
height:200px;
float:left;
text-align:center;
line-height:200px;
}
span{
width:208px;
height:204px;
display:block;
margin:0 auto;
}
</style>
</head>
<body>
<span>
<div id="div1">栏目1</div>
<div id="div2">栏目2</div>
</span>
</body>
</html>
在div{}中添加text-align:center;
不知道是不是这样
或者你给他们一个相同的左边距呢