Steven Matthews
Steven Matthews

Reputation: 11325

Multiple ids while still having the same "lower" classes?

So I've currently got this CSS:

#node_249 .container-inline-date .form-item .form-item {
float: none;
}

I would like to have it also affect the id #news-in-the-news.

Would

#node_249, #news-in-the-news .container-inline-date .form-item .form-item {
float: none;
}

Be the correct construction for that, or do I have to have

#node_249 .container-inline-date .form-item .form-item {
float: none;
}

and

#news-in-the-news .container-inline-date .form-item .form-item {
float: none;
}

Upvotes: 0

Views: 34

Answers (4)

DavideCariani
DavideCariani

Reputation: 273

you just join the lats two solutions in:

#node_249 .container-inline-date .form-item .form-item,
#news-in-the-news .container-inline-date .form-item .form-item {
  float: none;
}

Upvotes: 0

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114417

This selects a specific node UNDER #node_249:

#node_249 .container-inline-date .form-item .form-item

To add a different selector, separate them by a comma:

#news-in-the-news, #node_249 .container-inline-date .form-item .form-item

If you need both sub-sections, you need to add the entire selector to both, separated by a comma:

#node_249 .container-inline-date .form-item .form-item, #news-in-the-news .container-inline-date .form-item .form-item

Upvotes: 0

damoiser
damoiser

Reputation: 6238

Maybe not so DRY, but I know only this solution:

#node_249 .container-inline-date .form-item .form-item,
#news-in-the-news .container-inline-date .form-item .form-item {
  float: none;
}

Upvotes: 0

DaniP
DaniP

Reputation: 38262

You need to have that like this :

#node_249 .container-inline-date .form-item .form-item,
#news-in-the-news .container-inline-date .form-item .form-item {
  float: none;
}

Or you can assign the same class name on both id:

.equal .container-inline-date .form-item .form-item {
   float: none;
}

Upvotes: 1

Related Questions