怎样用CSS将着四个div实现同一条线,水平居中?
代码如下:<html><head><title></title><styletype="text/css">.one{border:2pxsolidred;width:2...
代码如下:
<html>
<head>
<title></title>
<style type="text/css">
.one{
border:2px solid red;
width:250px;
height:50px;
text-align:center;
background:#999;
float:left;}
.two{
border:2px solid red;
width:250px;
height:50px;
text-align:center;
background:#066;
float:left;}
.three{
border:2px solid red;
width:250px;
height:50px;
text-align:center;
background:#C90;
float:left;}
.four{
border:2px solid red;
width:250px;
height:50px;
text-align:center;
background:#F6F;float:left;}
</style>
</head>
<body>
<div class="one">one</div>
<div class="two">two</div>
<div class="three">three</div>
<div class="four">four</div>
</body>
</html> 展开
<html>
<head>
<title></title>
<style type="text/css">
.one{
border:2px solid red;
width:250px;
height:50px;
text-align:center;
background:#999;
float:left;}
.two{
border:2px solid red;
width:250px;
height:50px;
text-align:center;
background:#066;
float:left;}
.three{
border:2px solid red;
width:250px;
height:50px;
text-align:center;
background:#C90;
float:left;}
.four{
border:2px solid red;
width:250px;
height:50px;
text-align:center;
background:#F6F;float:left;}
</style>
</head>
<body>
<div class="one">one</div>
<div class="two">two</div>
<div class="three">three</div>
<div class="four">four</div>
</body>
</html> 展开
2个回答
展开全部
追问
追答
哦哦,那就将display:inline;改为display:inline-block;就行了。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询