5

I am using a slider that I can't modify the navigation text (next / previous) but I would like to replace the text with an arrow

I have added the arrows with the following css:

#carousel .hero-carousel-nav .prev a:after {
 font-family: "Glyphicons Halflings";
 color:#FFF;
 content: "\e079";
}
#carousel .hero-carousel-nav .next:after {
 font-family: "Glyphicons Halflings";
 color:#FFF;
 content: "\e080";
}

If I add the following CSS the arrow and text disappears

#carousel .hero-carousel-nav .prev a {
 text-indent:-9999px;
}

I want to keep the arrow but remove the text, is this possible?

THe HTML structure for the navigation is:

<ul class="hero-carousel-nav">
    <li class="prev">
        <a href="#">
          Previous
        </a>
    </li>
</ul>
4

2 回答 2

12

默认情况下,伪元素是inlineelement 和 follow text-indent。如果你成功了,float或者blockboxe ,它会一直在视野中。然后您仍然需要将其重置为text-indent可以0;

#carousel .hero-carousel-nav .next:after {
 font-family: "Glyphicons Halflings";
 color:#FFF;
 content: "\e080";
float:left;/* or display:block */
text-indent:0;
}
于 2014-05-24T22:16:27.863 回答
5

你可以尝试这样的事情:http: //jsfiddle.net/sandro_paganotti/HupTL/

div{
    position: relative;
    text-indent: -9000px;
}
div:after{
    content: 'hi!';
    display: block;
    position: absolute;
    text-indent: 0;
    top:0;
    left:0;
    right:0;
    bottom:0;
}
于 2014-05-24T22:15:32.350 回答