I'm a CSS beginner, slowly working through Dan Cedarholm's _Bulletproof Web
Design_, and (on p. 80, if you also have the book) he inserts class="img"
into a <dd> so he later can reference that class, identifying the <dd>s that
contains an image, as opposed to other <dd>s that contains only text.
Here's an example of each:

 

<dd class="img"><img src="img/gamlastan.jpg" width="80" height="80"
alt=Gamla Stan" /></dd>

 

<dd>This was taken in Gamla Stan (old Town) in a large square of amazing
buildings.</dd>

 

He then addressed this class in the CSS as follows:

 

#sweden dd.img img {float: left;}

 

I didn't see the point of adding the class to the html code because it
seemed to me that it could be identified without it, so I experimented by
leaving out the class and addressing it in the CSS with just

 

#sweden dd img {float: left;}

 

and it seemed to work fine.  But I'm the beginner, and the expert used the
class.  I'm sure there was a reason; I just don't know what it is.  Can
anyone tell me why it's necessary or a good idea to add that class to
identify the image?

 

Thanks!

 

Charles

 

______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to