IE9 中的 CSS 顶部填充

标签 css html internet-explorer-9

我有一个类似于下面的 CSS。

.ui-icon {
    font-size: 6em;
   height: 180px;
   width: 180px;
}

.ui-icon .ui-icon-label {
    padding-top: 15%;
}

顶部填充不显示 IE9 中的文本(即 ui-icon-label)。

下面还给出了 HTML。

<div class="ui-icon-color ui-icon">
<div id="icon-1">
<i class="icon-cog"></i>
</div>
<div class="ui-icon-label">My Label</div>
</div>

但相同的代码在 Chrome 和 Firefox 中运行良好。 IE9 显示 ui-icon-label 直到 padding 为 13.4%。直到这个值,当我逐渐增加它时,文本会向下移动一点。高于该值它突然消失。但对我来说,15% 看起来是放置标签的最佳位置。我经历了建议中提供的不同解决方案,例如“clear:both”或使用 W3C 验证器。但他们没有帮助。

仅供引用,icon-cog 类来自 font-awesome。

最佳答案

您是否考虑过使用带有媒体查询的 IE9 目标样式表来解决该问题?

 <!--[if IE 9]>
   <link rel="stylesheet" type="text/css" href="ie9.css" />
 <![endif]-->

 // In the CSS:

 @media (max-width: ???px) {
     .ui-icon .ui-icon-label {
        padding-top: 30%;
     }
 }

关于IE9 中的 CSS 顶部填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17006339/

相关文章:

css - 调整图像大小以适应浏览器

html - CSS Fluid 图像问题...垂直对齐和图像不是从 div 的顶部开始

html - 为固定 div 设置高度为 "the end of the window"

javascript - 从每行底部向上滑动显示文本

jquery - 互联网浏览器无法与精美盒子正常工作

css - 在 Bootstrap 4 中使用容器宽度

javascript - 基于同一模板的不同代码片段不会产生相同的结果

jquery - 如何更改选择标签的触发事件?

javascript - IE 10,9,8 : Can userAgent be changed through a javascript code?

html - IE9 下移列