CSS content counters breaks CSS in IE

冷暖自知 提交于 2019-12-22 18:38:39

问题


I do expect the site to require a few tweaks to work in IE although this time it appears like something is completely breaking the CSS in IE8 compatibility mode.

To start at the top with the logo position, I have added a red background to check its location and this is not even displayed, although you can see this in firefox. How come this is not being read correctly?

Website

EDIT:

I have narrowed this down to the exact code which causes IE to break:

.content ol li:before {
content: counters(item, ".") ": "; 
counter-increment: item
}

How could I get around this? Without manually adding the numbers. I wanted the numbered list to work like: 1.1.2 etc


回答1:


Generated content isn't supported in IE<8 (see When can I use...). A brief search didn't return any obvious alternative (a shim etc). Can you just accept that IE6/7 won't see your counters, or perhaps use Chrome Frame?




回答2:


Having worked through this issue myself, to avoid the IE7 parser error, change:

content: counters(item, ".") ": "; 

to

content: counters(item , ".") ": "; 

Note the whitespace between item and the comma. You can also wrap item in parentheses and it seems to work with all major browsers, though it seems a bit nonstandard.




回答3:


Transparent PNG images don't work in IE.

Here's a nice explanation and solution: http://24ways.org/2007/supersleight-transparent-png-in-ie6



来源:https://stackoverflow.com/questions/8212738/css-content-counters-breaks-css-in-ie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!