[thelist] CSS Guidance

Hassan Schroeder hassan at webtuitive.com
Sun Nov 23 15:34:10 CST 2003


On Sunday, Nov 23, 2003, at 13:07 US/Pacific, Gina Anderson wrote:

> <div class="blogbody"> that surrounds paragraphs of text, and any 
> image in
> that div that I display, I want to put a border around. I thought I 
> could do
> this without a class.
>
> I tried in the stylesheet:
>
> 	img.blogbody {
> 		border: 1px solid #DEDEDE;
> 		padding: 4px;
> 		}
>
> Which doesn't seem to work

because that *means* any IMG with a CLASS="blogbody" ...

> 	img {
> 		border: 1px solid #DEDEDE;
> 		padding: 4px;
> 		}
>
> Obviously puts a border around ALL the images, which I don't want. Why
> doesn't img.blogbody work? Can I do this without having to put a class 
> in
> the img src code, because I REALLY don't want to. :)

.blogbody img  {
	/* properties */
	}

Descendant selectors:
   <http://www.w3.org/TR/CSS2/selector.html#descendant-selectors>

The Recommendations are your friends :-)
--
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.




More information about the thelist mailing list