如何水平对齐跨度或div? [英] How do I align spans or divs horizontally?

查看:82
本文介绍了如何水平对齐跨度或div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我唯一的问题是让他们排成三排,并有相等的间距。显然,跨度不能有宽度和div(和跨度与显示:块)不会彼此水平地出现。建议?

My only problem is making them line up three-across and have equal spacing. Apparently, spans can not have width and divs (and spans with display:block) don't appear horizontally next to each other. Suggestions?

< div style ='width:30%; text-align:center; float:left;

<div style='width:30%; text-align:center; float:left; clear:both;'> Is what I have now.

推荐答案

您可以使用divs与 float:left; 属性,这将使它们彼此水平地显示在一起,但是您可能需要对以下元素使用清除,以确保它们不重叠。

You can use divs with the float: left; attribute which will make them appear horizontally next to each other, but then you may need to use clearing on the following elements to make sure they don't overlap.

这篇关于如何水平对齐跨度或div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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