嗨我有list-style-position的问题:在使用IE时内部.在Firefox或Chrome上,它似乎没有这个问题.
ol.myList { list-style-position:inside; } ol.myList li { padding:20px 10px; font-weight:bold } ol.myList li p { font-weight:normal }
<ol class="myList" start="1"> <li> <h4>My Title</h4> <p>My Details</p> </li> </ol>
在Chrome / Firefox上,它显示如下:
1. My Title My Details
但是在IE上它显示了这个:
1. My Title My Details
任何建议,以使其在IE上工作?
解决方法
这是浏览器之间的不一致. Firefox在单独的行上显示数字/项目符号,IE也是如此.
使用display:h4上的inline-block和* display:inline; zoom:1;对于IE7.
ol.myList li h4 { display: inline-block; *display: inline; zoom: 1; }
关于此问题的Mozilla文档引用:https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-position#Browser_compatibility
N.B. There is variance among browsers regarding behavIoUr when a block element is placed first within a list element declared as list-style-position:inside. Chrome and Safari both place this element on the same line as the marker Box,whereas Firefox,Internet Explorer and Opera place it on the next line. For more information on this,see this Mozilla 07001 and an 07002.