I'm trying to hide some text inside an <li>
element using CSS by setting text-indent: -999px;
.
For some reason this doesn't work when I set the direction of the document to "rtl"
(right to left - my site is in Hebrew).
When direction is "rtl" the text still shows...
Anyone knows why, and a way around this?
相关问题
- Adding a timeout to a render function in ReactJS
-
Why does the box-shadow property not apply to a
- Add animation to jQuery function Interval
- jQuery hover to slide?
- Issue with star rating css
I found the best way is to make the text a transparent color:
color: rgba(0,0,0,0);
Note: This bug still exists in firefox 12 (text-indent value is ignored on rtl)
My problem was with text-align. In case you modify align mode of the element or parent element(s) wrapping it to left, you must give a negative index for text-indent. Otherwise you must give a positive value.
Otherwise
I prefer this solution:
Along with
text-indent: -9999px
try usingdisplay: block;
. It solved for me.Additionally, if you need the li elements to float horizontally (e.g. a horizontal menu), use
float: left;
.What about setting
direction:ltr
on the elements you're trying to give negativetext-indent
?Demo: jsfiddle.net/Marcel/aJBnN/1/
text-align: right; works for me