Is text-indent: -9999px a bad technique for replacing text with images, and what are the alternatives?

前端 未结 5 2118
庸人自扰
庸人自扰 2020-11-30 02:19

This article say we should avoid using this technique. This one says it\'s awesome. Is it true that Google looks inside CSS files for text-indent: -9999px; and

5条回答
  •  长情又很酷
    2020-11-30 03:13

    Well there is an alternative (which I use quite frequently).

    do Stuff
    

    You can change span to strong/h1 etc. based on context.

    .mybutton{
      background: transparent url(images/SpriteWithButtons.png) no-repeat 20px 20px;
      display: block;
      width: 16px;
      height: 16px;
    }
    .mybutton span{
        display: none;
    }
    

提交回复
热议问题