Is there a way of hiding an element's contents, but keep its :before
content visible?Say I have the following code:
HTML:
<span class="addbefore hidetext">You are here</span>
CSS:
.addbefore:before { content: "Show this";}.hidetext { // What do I do here to hide the content without hiding the :before content?}
I've tried:
- using
display: none
and settingdisplay: inline
on:before
, but both are still hidden - using
width: 0; overflow: hidden
;, but then additional space seems to be added (?) - using color: transparent;, but then, of course, the content of the span still takes up space
- using
text-indent: -....px
, but- this is frowned upon by search engines and
- it seems not to work for span elements (?)
Any other ideas as to how I might do this?