如何水平对齐跨度或div?(How do I align spans or divs horizontally?)

编程入门 行业动态 更新时间:2024-10-26 14:32:50
如何水平对齐跨度或div?(How do I align spans or divs horizontally?)

我唯一的问题是让他们排成三横,间距相等。 显然,跨度不能有宽度和div(并且具有display:block的跨度)不会彼此相邻地出现。 建议?

<div style='width:30%; text-align:center; float:left; clear:both;'> <div style='width:30%; text-align:center; float:left; clear:both;'>是我现在有的

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; clear:both;'> Is what I have now.

最满意答案

您可以使用带有float: left; div 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.

更多推荐

本文发布于:2023-08-02 09:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1372260.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:跨度   水平   div   align   divs

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!