How can I show only the border of a div, but not the text using CSS?
This is not well supported by IE, but you could use:
#mydiv { color:rgba(0,0,0,0); border:1px solid #000 }
This makes the text color fully transparent, but leaves the border visible.
A simple cross-browser solution is the Phark "text indent" method. It's usually used for image replacement.
div.example {
border: 2px solid red;
/* Hide text inside "off left" */
text-indent: -10000px;
/* Make sure to set a width and height */
height: 100px;
width: 100px;
}
Pros:
Cons:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With