html - 向左浮动 span 和 div

标签 html css internet-explorer google-chrome css-float

我有这个问题: http://liberainformazione.it/

enter image description here

标题CSS规则:

p.right_sidebar_title {
font-size: 16px!important;
font-weight: bold;
color: black;
margin: 7px 0!important;
line-height: 18px!important;
font-family: Arial,Helvetica,sans-serif;
font-weight: bold;
width: 300px;
}

蓝色矩形 CSS 规则:

.post-category-rightSidebar {
background: #369;
display: inline;
float: left;
font-size: 10px;
height: 16px;
line-height: 17px;
margin-right: 5px;
padding: 0 5px;
text-transform: uppercase;
color: white;
}

在 Chrome 或 Firefox 中,蓝色矩形靠近标题,但在 IE 中,标题在新行上...... 我不明白为什么 IE 不识别我的 css 规则。

我做错了什么? 非常感谢。

最佳答案

您的页面有 <meta http-equiv="X-UA-Compatible" content="IE=7" /> , 所以 IE9 就像 IE7 一样运行。

在 IE7 中,指定 width或 ( height ) 值触发所谓的 hasLayout这使得元素的盒子有些孤立,并防止其内容被任何外部元素 float 。

您应该设置 X-UA-Compatible元元素到 IE=edge 值(最佳选项),或删除 width: 300px;来自 p.right_sidebar_title规则,或为包含两者 的容器指定此宽度 p.right_sidebar_title元素 float 颜色方 block 。

关于html - 向左浮动 span 和 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14126059/

相关文章:

javascript - Kendo Grid 数据项选择在 IE 中不起作用

css - 页面在 IE7 div 定位中显示不正确?

javascript - 当我按下键盘上的特定字母时,我想更改 div 大小

html - 在底部垂直对齐列表元素

php - 带有 float 文本和不对称边的自定义菜单

html - IE 11 背景位置未正确呈现

javascript - HTML5 History API 自动路由刷新错误

html - 检测将在 Ruby on Rails 中呈现为空的字符串

html - 什么 CSS 属性/HTML 元素提供了这种垂直线效果?

css - grunt concat_css 禁用输出