Different Style for ALT attribute

On the page where I list a User’s Friends, for each Friend I have the…

  • Username
  • Online Indicator
  • User Photo

…all wrapped in an <a> tag, with a bold, blue style assigned.

The problem is when the User’s Photo doesn’t appear - for whatever reason - and I get bold, blue styled ALT Text coming up.

Is there a way to make it some my ALT Text is just normal, un-bolded black font?

Thanks,

Debbie

Simply assigning styles to the img selector in your CSS will allow you to alter what the text looks like, for instance see the below would do what you are wanting.

img {
    font: 12px/16px normal Arial, Verdana, sans-serif;
}

It’s as simple as that :slight_smile:

Yes, or just set specific styles for those <a> links.

Except my <img> is inside the <a>, and thus the issue.

Debbie

Hey, that was obvious! :stuck_out_tongue:

But we aren’t out of the woods yet…

1.) How do I make the Font black? (It’s still blue.)

What I mean is can you do that in font or do I need a color: #000; ??

2.) My ALT is getting cut off. I think I need it to wrap in the tiny area where my Thumbnail should be.

Is that possible?

See attached…

Thanks,

Debbie

Scratch #2… It was a problem with my echo syntax!

Debbie

Why not just try it?

Again, can’t you at least just try what I suggested?


a {color: #000;}

[quote=“ralph_m,post:7,topic:17141”]

Why not just try it?[/quote]

Because I don’t want all of my hyperlinks black.

But I do want my ALT’s black.

[quote=“ralph_m,post:7,topic:17141”]

Again, can’t you at least just try what I suggested?

a {color: #000;}[/quote]

Ralph, I was asking if there is a short-hand on Font where you can nest the color inside that tag.

I know about color, plus, see above.

BTW, I think I have it all fixed now.

Thanks,

Debbie

You know about targeting specific elements with classes, though. :stuck_out_tongue:

If the img is inside an <a> then presumably you want the img to be a link. In the absence of the img, then surely you need the alt text to be the link instead. In that case, shouldn’t it look like a link?

Good point!

So I changed things to this…


img{
	border: none;
	font: 12px/16px normal Arial, Verdana, sans-serif;
	font-weight: normal;
	text-decoration: underline;
}

Thanks,

Debbie

P.S. Should I add in color: #F00; as well? :-/

You can if you want it to stand out more, on another note your don’t need the font-weight property as that is already been handled in the font property.