【发布时间】:2015-03-23 13:41:44
【问题描述】:
每次我刷新页面内容时,li 元素中的编号在 IE9 中向右下角移动,但在其他浏览器(firefox 和 chrome)上运行良好。这是否需要特定于 IE 的修复,还是我犯了一个错误?
Javascript:
if (jQuery("#" + divName).html() == "") {
document.getElementById(divName).innerHTML = content;
}
CSS:
ol.rounded {
counter-reset: my-counter;
list-style: outside none none;
margin: 0;
padding: 0;
}
ol.rounded li {
margin-bottom: 9px;
padding-left: 25px;
position: relative;
}
ol.rounded li:before {
border: 10px solid #69b13b;
border-radius: 50%;
content: "";
height: 0;
left: 2px;
position: absolute;
top: -3px;
width: 0;
z-index: -1;
}
ol.rounded li:after {
color: #FFFFFF;
content: counter(my-counter, decimal);
counter-increment: my-counter;
font-size: 1.2em;
font-weight: bold;
left: 8px;
position: absolute;
top: 1px;
}
HTML:
<ol class="rounded">
<li>
<p>Abhishek Agarwal</p>
</li>
</ol>
【问题讨论】:
-
为什么在 if 条件下使用 jQuery 但不进一步使用它?将
document.getElementById(divName).innerHTML = content;替换为jQuery("#" + divName).html(content);。其次,什么是counter-reset: my-counter?它不是有效的 CSS,是吗?
标签: javascript jquery html internet-explorer