我应该如何将yellowarea
保持在redarea
和greenarea
中间。
https://jsfiddle.net/ashish3506/4wopk1u3/1/
我的 HTML 代码
<body>
<span class="redarea"></span>
<span class="yellowarea"></span>
<span class="greenarea"></span>
</body>
我的 CSS 代码
.redarea{
width:300px;
height:300px;
background:red;
float:left;
}
.yellowarea{
width:300px;
height:300px;
background:yellow;
margin-left:400px;
}
.greenarea{
float:right;
width:300px;
height:300px;
background:green;
}
最佳答案
只需这样做
span {
width:300px;
height:300px;
display:inline-block;
}
.redarea{
background:red;
}
.yellowarea{
background:yellow;
}
.greenarea{
background:green;
}
关于css - 如何水平对齐一行中的 3 个跨度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28723342/