简体   繁体   English

Firefox(3.6.3 Mac)无法在一组左浮动列表项的最后一个浮动到左

[英]Firefox (3.6.3 Mac) fails to float left the last of a set of left-floated list items

I have a set of <li> elements in an unordered list. 我在无序列表中有一组<li>元素。 The items are all floated left, with a bit of space between them. 这些项目都向左浮动,它们之间留有一点间距。 Problem is, the last list item is wrapped (isn't at the end of the list, but leftmost on a new line). 问题是,最后一个列表项被包装了(不在列表的末尾,而是在最左一行的新行中)。 I have no idea why. 我不知道为什么。 The rendering is fine with Mac Safari and with IE 7. 使用Mac Safari和IE 7渲染效果很好。

The CSS for the li items floats them left: li项目的CSS使它们向左浮动:

list-style: none;
float: left;
padding: 1px 1px 0 1px;
margin-right: 1px;
border: 1px solid #2A3139;  /* to hold space for hover border */

Another factoid: the unordered list is in a div (for clipping purposes; the list is scrolled horizontally); 另一个事实:无序列表位于div中(出于剪切目的;列表水平滚动); the CSS for the <ul> specifies: <ul>的CSS指定:

overflow: none;
position: relative;

(though I don't think this is related to the problem... but one never knows) (尽管我不认为这与问题有关……但从未有人知道)

Is the width of your container div wide enough to accommodate the width of all your li elements PLUS their margins and borders? 容器div的宽度是否足以容纳所有li元素的宽度加上其边距和边界? If not, the floats will wrap to the next line if there is not enough space. 如果没有,则如果没有足够的空间,则浮点数将换行到下一行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM