Quantcast
Channel: Unicode character for "X" cancel / close? - Stack Overflow
Viewing all articles
Browse latest Browse all 38

Answer by judyofthewoods for Which font for CSS "x" close button?

$
0
0

You can use text that is only accessible to screen readers by placing it in a span which you hide in an accessible way. Place the x in the CSS which can't be read by screen readers, thus won't confuse, but is visible on the page, and also accessible by keyboard users.

<style>
.hidden {opacity:0; position:absolute; width:0;}
.close {padding:4px 8px; border:1px solid #000; background-color:#fff; cursor:pointer;}
.close:before {content:'\00d7'; color:red; font-size:2em;}
</style>

<button class="close"><span class="hidden">close</span></button>

Viewing all articles
Browse latest Browse all 38

Trending Articles