blog

[ ]
Text-indent?
Can be used
for styling or
hiding text

Solved: IE7 Negative Text-Indent CSS Bug

Negative text indents can be really useful for hiding text from the viewer while keeping text visible to search engines or text-to-speech applications. Sometimes they’re used simply for style-sake. However IE7 gets a little wonky sometimes when text-indents are negative.

To get IE7 to play nice with negative text indents, add this to your CSS:

text-transform:capitalize

For some unknown reason, IE7 wakes up and plays nice. Alternatively you can do this:

font-size: 0;
line-height: 0;
text-indent: none

Don’t bother trying text-indent:inherit. IE7 doesn’t support “inherit”.

Related Posts:

9

9 Responses to “Solved: IE7 Negative Text-Indent CSS Bug”

  1. 1
    June 27, 2011 at 6:02 am

    hey loved this website

  2. 2
    July 4, 2011 at 9:56 am

    Hey, Really Appreciate this update, can I set it up so I get an email sent to me when you publish a fresh article?

    • 2.1
      Weszt | Reply
      July 4, 2011 at 10:39 am

      My pleasure!

      I’ve recently added email subscription which you can sign up for here.

  3. 3
    July 15, 2011 at 1:02 pm

    Isn’t hiding text considered bad practice that can result in penalties from the search engines? I want to do it on a page for legitimate reasons but I’m unsure if it will hurt my rankings.

    • 3.1
      Weszt | Reply
      July 15, 2011 at 1:07 pm

      Naomi – you are absolutely right. It’s not a good practice where search engines are concerned.

      However in the case of web apps where much it may be off limits to search engines, this is probably okay.

  4. 4
    Robin | Reply
    June 4, 2012 at 6:19 am

    Thank you for this! My jQuery UI icons kept disappearing in IE7, but this somehow fixed it.

    • 4.1
      Weszt | Reply
      June 14, 2012 at 9:54 pm

      You’re welcome – glad I could help!

  5. 5
    saurabh | Reply
    November 2, 2012 at 4:41 am

    nice solution

    • 5.1
      Weszt | Reply
      November 3, 2012 at 8:38 am

      Thank you! Took a while to find it ;)

Leave a Reply