0

How would I combined the follow into one block

#idOne td, th {
  ......
}

#idTwo td, th {
  ......
}

I tried

#idOne td, th,
#idTwo td, th {
  .....
}

but theth is included as its own.

Any ideas? Thanks

4
  • What do you mean "the th is included as its own"? Commented Dec 5, 2014 at 23:12
  • 1
    Oh, you have th in there twice... you could remove one of them. Commented Dec 5, 2014 at 23:13
  • You need to realize that its a comma separated list of selectors. You want a unique list of selectors. Were you thinking #idOne td, #idOne th, #idTwo td, #idTwo th { ... }? Otherwise all th will get the styling in the block. Commented Dec 5, 2014 at 23:14
  • @bryjohns yeah thats what I was thinking, just couldnt get it out right. Thanks Commented Dec 5, 2014 at 23:32

2 Answers 2

3

You need to specify the parent for each of the td and th tags:

#idOne td, #idOne  th, #idTwo td, #idTwo th {
  ......
}
Sign up to request clarification or add additional context in comments.

2 Comments

for some reason i thought the parent was carried over. my mistake. thanks
@NorCalKnockOut Unfortunately css isn't so clever. If you use less or sass you can nest your your selectors so it would be something like #idOne, #idTwo { th, td { ... } }. That's probably what you were thinking css would do for you as the idea its very intuitive.
1

Given the question example, the correct way would be this:

#idOne td, #idTwo td, th {
  .....
}

But I've a feeling that the example might not be quite as you intend.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.