text-indent doesn't work with anchor tag

后端 未结 4 1047
执笔经年
执笔经年 2021-01-06 01:33

http://jsfiddle.net/corinem/TtPgy/

I\'m using:

Lorem ipsum dolor.

css:

a{text-indent:-         


        
相关标签:
4条回答
  • 2021-01-06 01:41

    As the other answers suggest you can only apply text-indent: -9999px to a block element. You can use display: inline-block or display: block; and it will work.

    I would also suggest using

    text-indent: 100%;
    white-space: nowrap;
    overflow: hidden;
    

    Instead of text-indent: -9999px; since -9999px forces the browser to create a 9999px box offscreen. Learn more about this "hack" here: http://www.zeldman.com/2012/03/01/replacing-the-9999px-hack-new-image-replacement/

    0 讨论(0)
  • 2021-01-06 01:56
    p{
    color: red;
    font-family: tahoma;
    font-size: 12px;
    line-height: 18px;
    }
    
    p+p{
    font-family: tahoma;
    text-indent: 20px;
    color: red; 
    font-size: 12px;
    line-height: 18px;
    }
    
    0 讨论(0)
  • 2021-01-06 02:00

    tag is block but a is inline ,you must write a{text-indent:-9999px;display:inline-block;}

    0 讨论(0)
  • 2021-01-06 02:02

    You can only do that with block items.

    Use:

    p,a{
        text-indent: -9999px;
        display:block
    }
    

    Or you can wrap your a tag in a block item and style that instead.

    0 讨论(0)
提交回复
热议问题