Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doing overlays without an empty div

Tags:

html

css

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.

How can I do overlays without an empty div?

like image 284
Randomblue Avatar asked May 23 '26 18:05

Randomblue


1 Answers

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.

Example: http://jsfiddle.net/dppJw/2/

like image 185
Sotiris Avatar answered May 25 '26 06:05

Sotiris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!