How To Style Alt Text Color? - Html - Stack Overflow

    1. Home
    2. Questions
    3. Tags
    4. Users
    5. Companies
    6. Labs
    7. Jobs
    8. Discussions
    9. Collectives
    10. Communities for your favorite technologies. Explore all Collectives

  1. Teams

    Ask questions, find answers and collaborate at work with Stack Overflow for Teams.

    Try Teams for free Explore Teams
  2. Teams
  3. Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Get early access and see previews of new features.

Learn more about Labs How to style alt text color? Ask Question Asked 12 years, 11 months ago Modified 12 years, 11 months ago Viewed 16k times 3

I want to style alt text color of map area image -> alt="Victoria's Secret" By default is blue, but I want to be red! I tried some methods without sucess... Any help?

This is my code:

<map name="Map" id="Map"> <area shape="rect" coords="22,4,126,50" href="http://www.victoriassecret.com/" target="_blank" alt="Victoria's Secret"/> Share Improve this question Follow edited Jan 28, 2012 at 14:03 Raymond Chen's user avatar Raymond Chen 45.2k11 gold badges99 silver badges144 bronze badges asked Jan 28, 2012 at 10:35 Aleksandar's user avatar AleksandarAleksandar 5113 gold badges10 silver badges21 bronze badges Add a comment |

2 Answers 2

Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 9

"Alt text" is, contrary to popular belief, not the system-generated message that shows up when hovering over items. The text you see in those is set in the title attribute of the element and cannot be styled.

However, the actual alt text, being the text that is displayed when an image is not loaded can be styled like you would style text in any other element. For example:

img { color: red; text-align: center; }

will make the alternate text red and horizontally center it within the container.

However, if that is not at all what you meant, and you meant the system-generated tooltips, you'll want to follow ose's advice and create a custom tooltip, which will probably take a bit more work than you intended.

I'd advice you to go with a pure HTML/CSS tooltip though, as not everyone has JavaScript on. This seems like an okay one I just Googled up: Pure CSS Tooltips

Share Improve this answer Follow edited Jan 28, 2012 at 15:41 Matthew's user avatar Matthew 8,42610 gold badges39 silver badges66 bronze badges answered Jan 28, 2012 at 14:14 MichD's user avatar MichDMichD 1,1808 silver badges16 bronze badges 3
  • Ok, I can change img alt text color (when image not load, I can show alt text for this image and I can make a style) but in my case, I have image, and I used area map over image, to link this image, and add alt text to area map. This text I cannot colored... – Aleksandar Commented Jan 28, 2012 at 14:37
  • After actually playing around a bit with map and area, it seems that you cannot actually style and area element, I'm afraid. :/ I cannot manage to get the alt text for an area element to display. I believe the alt tag is just there for browsers that don't support the area tag. – MichD Commented Jan 28, 2012 at 15:01
  • I use this rule for one of my sites, custom color works on desktop browsers, but not on mobile: img { width: 256px; color: red; text-align: center; font-style: italic; } – Arthur Khazbulatov Commented Apr 12, 2020 at 12:49
Add a comment | 1

Can you be more specific in your target platform, language etc.

I am assuming you are trying to change the alt text in a HTML page.

This is unfortunately not possible see here as alt text is set by the browser/operating system.

Aside from which, alt text is generally used to improve the accessibility of the site. You should probably leave this alone even if you could change it.

If you want to create a tooltip (popup text), then there are many DHTML scripts out there for doing that such as this

Share Improve this answer Follow answered Jan 28, 2012 at 10:47 ose's user avatar oseose 4,0752 gold badges25 silver badges40 bronze badges 0 Add a comment |

Your Answer

Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid …

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

Draft saved Draft discarded

Sign up or log in

Sign up using Google Sign up using Email and Password Submit

Post as a guest

Name Email

Required, but never shown

Post Your Answer Discard

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.

  • The Overflow Blog
  • Developers want more, more, more: the 2024 results from Stack Overflow’s...
  • How AI apps are like Google Search
  • Featured on Meta
  • The December 2024 Community Asks Sprint has been moved to March 2025 (and...
  • Stack Overflow Jobs is expanding to more countries

Linked

0 Custom alternative text of the unload the image 3 use alt or title on text 3 How to style the string of an <alt> tag? 71 Can I style an image's ALT text with CSS? 0 Edit "alt" text 3 'alt' inside span 0 Is it possible to only style part of an image's alt text? 2 Alt tag not displayed on browser 0 why alt in html not display the text? 0 How to use ALT tag correctly? 4 Can an alt attribute be set using CSS?

Hot Network Questions

  • No other coauthors, just me and my supervisors—is this normal?
  • Suppressing \uchyph=0 in only one section
  • What is the origin of "litera" versus "littera"?
  • The MC dies a few years after an apocalypse, but wakes up years earlier, just days before it starts. Uses his knowledge to gain skills faster
  • Is this position possible to have been made legally?
  • Working in another country by Nomad Visa while holding Germany Blue Card
  • What religious significance does the fine tuning argument have?
  • Can SHA-256 be used as a crude replacement for cryptographic signing?
  • Would a thermometer calibrated for water also be accurate for measuring the air temperature (or vice versa)?
  • Are there any languages without adpositions?
  • Why was "the barn" "every bit as good" in "Wuthering Heights"?
  • Why does capacitive coupling require a base resistor in an emitter follower?
  • Can game companies detect pirated games and sue if the user obtained the games using legitimate ways in other platforms?
  • Measuring Hubble expansion in the lab
  • Extrapolate data to a straight line
  • What use is SPF for email security in a cloud / SAAS world
  • Publication in a journal that has now disappeared entirely. Can I publish the paper elsewhere?
  • Connections between the path integral formulation and the Fourier transform
  • Is "Klassenarbeitsangst" a real word? Does it accord with general rules of compound noun formation?
  • Online Service Course in the era of ChatGPT
  • Preventing icing in below zero conditions during taxiing
  • Why do we define the standard error to ignore bias (unlike MSE which includes bias)?
  • What bladed melee weapon would be best suited for a warrior in zero-gravity?
  • Movie about dirty federal agents
more hot questions Question feed Subscribe to RSS Question feed

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

lang-html

Từ khóa » Html Image Alt Text Color