View Full Version : Stupid that I don't already know how...
GarrenNatas
06-29-2005, 10:03 PM
How do I make text (link to be exact) change color upon mouseover? Or should I not bother with the text and just make two images and js those for mouseover?
mwinter
06-29-2005, 10:44 PM
How do I make text (link to be exact) change color upon mouseover?For all links, use the following CSS:
a:link {
background-color: ...;
color: ...;
}
a:link:hover {
background-color: ...;
color: ...;
}If you only have specific links in mind, then you'll obviously need to change the selector, either using the document structure, or a class attribute.
For example, if the links were in a particular paragraph, you might use:
#paragraph a:link {
/* ... */
}
#paragraph a:link:hover {
/* ... */
}where paragraph was the id attribute value of the p element.
Using a class, you might have:
a.external:link {
/* ... */
}
a.external:link:hover {
/* ... */
}with links like:
<a class="external" href="...">...</a>
Or should I not bother with the text and just make two images and js those for mouseover?No. In this case, CSS is much better for a couple of reasons.
The first is that the text is resizable, which is a good accessibility bonus. Using images to present text can lead to sites that are hard to read for those with less-than-perfect eyesight, unless you're careful.
The second benefit is that you don't rely on client-side scripting. Whilst CSS is optional just like scripts are, style sheets are disabled less often.
The third is that using plain text requires much less traffic. A well-designed script will be at least a couple of kilobytes - the images will be too (and you'll have two per link). Finally you have the links in HTML. Compare that to just simple HTML and a couple hundred bytes in a style sheet, and the difference could be significant (depending on the number of links).
Hope that helps,
Mike
GarrenNatas
07-15-2005, 05:00 PM
Thank you very much. I ended up going the CSS route and it worked perfectly.
But... Now I have another issue and it's going to be basic HTML and it really should be something that I'm going to end up hitting myself for (especially since I probably learned this in high school), but how do I bottom align a background image? Is it possible to put a "valign" tag into the body or table tag after the "background=..." or would that just screw everything up more??? If you can, I could use an answer on this ASAP. THANKS!
mwinter
07-16-2005, 02:11 PM
[...] how do I bottom align a background image?You need to use CSS again:
selector {
background: color url(image) left bottom;
}There are obviously things you'll need to change there (selector being the most important). You might also want to align the image differently horizontally - other values[1] are center and right. If you don't want to have the background repeated, then add one of the repeat-x, repeat-y, or no-repeat keywords.
Hope that helps,
Mike
[1] You can also use percentages. For instance, 0% 100% is equivalent to left bottom.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.