如何使用CSS来并排浮动3个div [英] How to float 3 divs side by side using CSS

查看:156
本文介绍了如何使用CSS来并排浮动3个div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何使2 divs并排浮动,只需向左移动一个,向右移动另一个。

I know how to make 2 divs float side by side, simply float one to the left and the other to the right.

但是如何使用3个div来做到这一点,还是应该仅仅使用表来实现这个目的?

But how to do this with 3 divs or should I just use tables for this purpose?

推荐答案

只需给他们一个宽度和 float:left; ,这里是一个例子:

Just give them a width and float: left;, here's an example:

<div style="width: 500px;">
 <div style="float: left; width: 200px;">Left Stuff</div>
 <div style="float: left; width: 100px;">Middle Stuff</div>
 <div style="float: left; width: 200px;">Right Stuff</div>
 <br style="clear: left;" />
</div>

这篇关于如何使用CSS来并排浮动3个div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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