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

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

问题描述

我知道如何使2个div并排浮动,只需将一个div浮动到左侧,将另一个div浮动到右侧.

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天全站免登陆