Forum Home
Press F1
 
Thread ID: 106593 2010-01-15 00:33:00 CSS problem can't assign border color to image within table cell Morgenmuffel (187) Press F1
Post ID Timestamp Content User
848822 2010-01-15 00:33:00 Hi

CSS problem can't assign border colour to image within table cell

the css


.greyback {
background: #CBCFD2;
}
img.greyback {
border: 6px solid #cbcfd2 ;
}


the html


<td width="50%" align="left" valign="top" class="greyback">
<h5>
<a href="bla.htm">
<img src="images/8-small.jpg" width="100" height="141" border="0" align="left">
</a>
Life's a Hedgehogs Sausage
</h5>

<p>A random Paragraph
</p>
</td>



Now i assumed that the above would put a grey border around the image, but it doesn't seem to be applying,
I can get it to work by doing the following


img.greyb {
border: 6px solid #cbcfd2 ;
}

and adding the class to the image


<img src="images/8-small.jpg" class="greyb" width="100" height="141" border="0" align="left">

But I had assumed it would work the first way, and I don't understand why it doesn't

Any help would be appreciated
Morgenmuffel (187)
848823 2010-01-15 12:27:00 Your CSS was a bit off, it should be:
.greyback {
background: #cbcfd2;
}
.greyback img {
border: 6px solid #cbcfd2;
}You could even get a little more specific, maybe even .greyback h5 a img if that's how they're always going to structured.
sal (67)
1