: I tried it and it works perfectly for me. Note that the color and font-size properties won't have any effect in Chrome, since no text gets displayed. (Firefox displays the alt text if the
I tried it and it works perfectly for me. Note that the color and font-size properties won't have any effect in Chrome, since no text gets displayed. (Firefox displays the alt text if the image cannot be found.) Using the width property, for example, shows that it works fine. I'll post my code below for you to see.
However, to your original question, targeting what is essentially a "free text" field in CSS is prone to mishap. It's very easy to change an alt attribute without thinking about repercussions in CSS (as opposed to changing a class name where it should be obvious).
Furthermore, since you are already targeting an ID you only need to use that selector - an ID can only be used once per page.
<!DOCTYPE html>
<html>
<head>
<style>img#logo[alt="Site Title"] { width:200px }</style>
</head>
<body>
<img alt="Site Title" src="bullet.png" id="logo" />
</body>
</html>
More posts by @Yeniel560
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.