在HTML中,如何控制CSS使两个元素居中靠拢但是又保持一定距离?

如图顶部文字

还有图中布局是怎么实现的?上下宽度为什么不一样? 谢谢~!

<style>
.div1{width:500px;height:250px;margin:0 auto;}
.a,.b{float:left;}
.a{width:250px;height:250px;margin-right:50px;background:#f00}
.b{width:200px;height:250px;background:#0f0}
</style>
<div class="div1">
<div class="a"></div>
<div class="b"></div>
</div>
温馨提示:答案为网友推荐,仅供参考
第1个回答  2014-04-27
在css中使用margin和float属性

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网