CSS在一行中创建3个div块,div结构 [英] CSS creating 3 div blocks in one line, div structure

查看:73
本文介绍了CSS在一行中创建3个div块,div结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许有人可以帮助我解决上面表示图像的divs结构,以及是否有持有人div的特殊css参数,或者其他也可以添加它们?

Maybe anyone could help me with divs structure which would represent image above and if there are any special css parameters of holder div, or other add them too?

推荐答案

有很多方法可以做到这一点,其中之一就是使用相对浮动

The are many ways to do that, one of them is with relative-float

<div style="position:relative">
    <div style="float:left; width: 50px; height:100px; background-color:red;">Block1
    </div>
    <div style="float:left; width: 50px; height:100px; background-color:blue;">Block2
    </div>
    <div style="float:left; width: 50px; height:100px; background-color:green;">Block3
    </div>
</div>

这会生成类似

这篇关于CSS在一行中创建3个div块,div结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆