Forum Moderators: not2easy

Message Too Old, No Replies

Class and ID without Style?

I just need it for context...

         

Emperor

11:40 pm on Oct 13, 2004 (gmt 0)

10+ Year Member



Hi guys,

Is it alright to not have a class or id defined but still give it a class or id value? Like this:

<div class="red">
<div class="square">
some stuff
</div>
</div>

Now, there will *not* be a div.red in the CSS but there will be this:

div.red div.square {some stuff}

So I am just using it for context. It seems to work fine but I wanted to be sure.

Take care,
Emperor

vkaryl

11:45 pm on Oct 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you tried validating it? That's usually how I figure out some of the quasi-dodgy stuff I keep wanting to use.... I'm not saying yours is dodgy, btw - I don't know; but validating might give you a place to start!

encyclo

12:25 am on Oct 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's no problem at all. You can add an id or class and not define it at all within the CSS, and it will still be just fine.

In your case, you're using it in a perfectly normal manner - applying a style to a child element of your identified div.