IE CSS显示:inline-block渲染问题 [英] IE CSS display: inline-block Rendering issue

查看:174
本文介绍了IE CSS显示:inline-block渲染问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个恼人的渲染问题与IE
我的代码是



CSS:

  div {
display:inline-block;
margin-right:40px;
border:1px solid;
}

HTML:



p $ p> < div>元素< / div>
< div>元素< / div>
< div>元素< / div>
< div>元素< / div>
< div>元素< / div>

这是它在firefox / chrome(预期显示)中的样子



>



这是它在IE中的外观





如果IE支持display:inline-block,显然是这样。

解决方案

将DOCTYPE添加到您的html,

 <!DOCTYPE html PUBLIC  - / W3C // DTD XHTML 1.0 Transitional // ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> 





注意:在jsFiddle中,DOCTYPE是自动生成的,因此它会在那里工作。



修改1:
查看了解详情,



编辑2:
您可以阅读更多关于inline-block样式的信息此处


I'm having an annoying rendering issue with IE my code is

CSS :

div {
    display: inline-block;
    margin-right:40px;
    border: 1px solid;
}

HTML :

<div>element</div>
<div>element</div>
<div>element</div>
<div>element</div>
<div>element</div>

This is how it looks in firefox/chrome (the expected display)

This is how it looks in IE

I googled if IE supports display: inline-block, and apparently it does.

解决方案

Add DOCTYPE to your html,

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

It works for me after I added this.

Note: in jsFiddle, DOCTYPE was automatically generated so it will work there.

Edit 1: Check this for more information,

Edit 2: You can read more about inline-block styling here

这篇关于IE CSS显示:inline-block渲染问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆