做没有空div的覆盖 [英] Doing overlays without an empty div
问题描述
我从这个问题学习了如何做覆盖。但是,接受的答案使用空的 div
,其中 Chris Coyier < a>会认为是不是语义的,因为空 div
是纯粹的风格,而不是语义。
I learned from this question how to do overlays. However, the accepted answer uses an empty div
, which Chris Coyier would argue is "not semantic" because the empty div
is purely stylistic, not semantic.
我做了没有空的 div
的覆盖图?
How can I do overlays without an empty div
?
推荐答案
发布,您可以使用:后
而不是一个空元素。当然,你必须记住,:之后
不支持ie7和更低。在这种情况下,您可以使用javascript仅为ie7和更低版本添加一个空元素。
Using the example you posted, you can use :after
instead an empty element. Of course you have to keep in mind that :after
is not supported by ie7 and lower. In this case you can use javascript to add an empty element only for ie7 and lower.
示例: http://jsfiddle.net/dppJw/2/
这篇关于做没有空div的覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!