The disappointing thing here is that the "X" is not transparent (as I probably create PNG, at least).
I put together this quick test. http://jsfiddle.net/UM3a2/22/embedded/result/ , which allows you to colorize the positive space, leaving the transparent space negative. Since it is made entirely from borders, it is easy to colorize, since the default color matches the color of the text.
This does not fully support IE 8 and earlier (problems with radius radius), but it falls pretty nicely onto the square (if you're ok with the square close button).
It also requires two HTML elements, since you are only allowed to use two pseudo-elements for each selector. I donβt know exactly where I found out, but I think it was in an article by Chris Coyer.
<div id="close" class="arrow-tb"> Close <div class="arrow-lr"> </div> </div> #close { border-width: 4px; border-style: solid; border-radius: 100%; color: #333; height: 12px; margin:auto; position: relative; text-indent: -9999px; width: 12px; } #close:hover { color: #39F; } .arrow-tb:after, .arrow-tb:before, .arrow-lr:after, .arrow-lr:before { border-color: transparent; border-style: solid; border-width: 4px; content: ""; left: 2px; top: 0px; position: absolute; } .arrow-tb:after { border-top-color: inherit; } .arrow-lr:after { border-right-color: inherit; left: 4px; top: 2px; } .arrow-tb:before { border-bottom-color: inherit; bottom: 0; } .arrow-lr:before { border-left-color: inherit; left: 0; top: 2px; }
nick saemenes Apr 25 '13 at 23:25 2013-04-25 23:25
source share