Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hiding text using "text-indent"

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?

like image 817
Crippletoe Avatar asked May 08 '10 15:05

Crippletoe


People also ask

How do I hide text-indent in CSS?

Try setting text-alignment to match the direction in which you are indenting text. For example, if you use LTR and want to indent text negatively, besides adding display: block, you should also add left alignment. Not sure for RTL, but seems logical you should indent it positively and use right alignment.

How do I hide text messages without tags?

visibility:hidden , color:transparent and text-indent will do this. the font-size:0 option will work better I think. It should be remembered that some of these solutions will only hide the text. They will still leave a space for it on the screen.

What is the use of text-indent?

Definition and Usage The text-indent property specifies the indentation of the first line in a text-block. Note: Negative values are allowed. The first line will be indented to the left if the value is negative.


1 Answers

Along with text-indent: -9999px try using display: block;. It solved for me.

Additionally, if you need the li elements to float horizontally (e.g. a horizontal menu), use float: left;.

like image 173
kaustavdm Avatar answered Sep 22 '22 13:09

kaustavdm