Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 5
    This does not focus on the alternative text, but instead on any image element that contains alt-attribute. Commented Jun 5, 2014 at 12:57
  • 1
    You can use a class on image or a regular expression on src to target the specific image. Simple css my friend.
    – katsampu
    Commented Jun 18, 2014 at 9:57
  • 3
    katsampu, the original question asked about targeting the alt text, In your answer you are talking about "style only the alternative text". This statement is incorrect. This does not target the text, but the image element around it. If I set img[alt]{border:1px solid red;padding:10px;} those changes effect the image itself, not the alt text. Some changes may be inherited into the alt text too (depending on browser implementation). But it does not only style the alt text like you said. It styles only image elements that have alt text attribute. See the difference? Commented Jun 19, 2014 at 9:58