views:

59

answers:

2

I'd like to know how to write a css block that applies to either multiple ids or multiple classes:

Something like:

.class1, .class2 {
 ...
}

or

#id1, #id2 {
 ...
}

I'd like to know how to do both cases (which hopefully are cross browser compliant). Thanks.

Update: To make it more interesting, is this valid too?

#id tr, #id2 tr {

}

?

A: 

You are looking for something like this :

.oddBoxOut, 
.evenBoxOut {
  width: 12em;
  padding: 0.5em;
  margin: 0.5em;
  border: solid 1px black;
}

.oddBoxOut {
  float: left;
}

.evenBoxOut {
  float: right;
}

Update :

p#exampleID1 { background-color: blue; } 
p#exampleID2 { text-transform: uppercase; }
Pranay Rana
For my update, I actually want to select them both in the same block: something like #id1 tr, #id2 tr {} Is that right? Or should it be: tr#id1, tr#id2{} ?
aeq
as per the notation tr#id1, tr#id2{} is right not tried #id1 tr, #id2 tr {} this one
Pranay Rana
A: 

For you update it is also valid,

#id1 tr {

}

means that every child of node id #id1 will be CSS'ed.

you can do this too

tr#id1 {

} 

Only tr will be affected if id == #id1

The Elite Gentleman