html - 第二、第三等水平子弹(LI)被向下推

标签 html css

在此页面上,我被要求查看(请参阅下面的链接),UL#columns 内的第二个和第三个 LI 被向下推。

删除 default.css 第 61 行上的 clear:both 可以修复此问题。但是,我不清楚为什么。有什么想法吗?

#columns {width: 960px; clear: both; margin-top: 90px;}
#columns li {width: 290px; float: left; display: inline-block; background-position: center top; background-repeat: no-repeat; text-align: center; margin-right: 40px; opacity: 0;}
#columns li:nth-child(3) {margin-right: 0;}
#columns li h3 {font-size: 22px; color #33343d; display: block; clear: both; margin-top: 50px;}
#columns li P {color: #78797d; font-size: 15px; margin-top: 10px;}

#columns li.heart {background-image: url('../img/icons/heart.gif');}
#columns li.phone {background-image: url('../img/icons/phone.gif');}
#columns li.wheel {background-image: url('../img/icons/wheel.gif');}

enter image description here

最佳答案

您正在使用 float:leftdisplay:inline-block,删除 float:left 就可以正常工作了!

您可以将 float:leftclearfix 一起使用,而不是使用 inline-block,例如 this one !

要使 IE 与 inline-block 配合使用,请添加以下行:

*display : inline;
*zoom : 1;

关于html - 第二、第三等水平子弹(LI)被向下推,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15290253/

相关文章:

html - 如何使用 CSS 跨浏览器绘制垂直文本?

html - Bootstrap 4 : Placing a image between two card blocks

javascript - HTML5 将文件从一个框拖到另一个框。不能正常工作

javascript - Jquery鼠标悬停添加css

javascript - 将 CSS3 matrix3D 绘制到 Canvas 2D 元素

html - -webkit-flex 无法在 Android 上正确显示

html - 获得 Wordpress 主题的纯 HTML/CSS 版本,没有 PHP?

javascript - 单击按钮时重叠

javascript - Bootstrap3 + IE9 : Navbar not expanding

html - 创建投影时我的 anchor 标记不可点击