...

View Full Version : Applying CSS image opacity technique to a single table



adllop
05-08-2008, 09:53 PM
Hi there, I'm designing a website where on one of the pages, I've decided to use the css image opacity code on certain images so that when the viewer rolls over them they go from an opacity of 50% to 100%. Problem is, I have no clue on how to apply that effect to only one table in the page (the table where the images are located), if I try and use the code for the entire page, it affects my other image links and I don't want that. The code I'm using right now is:


<STYLE type=text/css>
a:link img {filter:alpha(opacity=50); -moz-opacity:0.50; opacity:0.50;}a:hover img {filter:alpha(opacity=100); -moz-opacity:1.00; opacity:1.00;}a:active img {filter:alpha(opacity=100); -moz-opacity:1.00; opacity:1.00;}a:visited img {filter:alpha(opacity=50); -moz-opacity:0.50; opacity:0.50;}</style>

Normally this code goes into the header of the page and that's it, but I want to apply that to a single table within the page. If anyone could be so kind as to help me, I would greatly appreciate it, I've been searching the internet all over, but to no avail. Thanks!

Apostropartheid
05-08-2008, 10:23 PM
<!doctype html>
<style type="text/css">
#myTable a:link img {
opacity: 0.5;
}
</style>
<!--[if IE]>
<style>
#myTable a:link img {
filter:alpha(opacity=50);
}
</style>
<![endif]-->
<p>This table will have the opacity rule applied to it.</p>
<table id="myTable">
<tbody>
<tr>
<td>Some place.</td>
<td><a href="/"><img src="/somewhere.jpg" alt="Somewhere."/></a></td>
</tr>
</tbody>
</table>
<p>This won’t.</p>
<table>
<tbody>
<tr>
<td>Some place else.</td>
<td><a href="/"><img src="/somewhere-else.jpg" alt="Somewhere else."/></a></td>
</tr>
</tbody>
</table>Basically, use IDs.

VIPStephan
05-08-2008, 10:35 PM
And don’t use tables.

(…unless you display tabluar data, that is)

adllop
05-08-2008, 11:11 PM
Thank you so much for the replies, they were really helpful : )



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum