• Create Account

# "Class descendant Class" selector in CSS

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

5 replies to this topic

### #1Servant of the Lord  Crossbones+   -  Reputation: 12802

Like
0Likes
Like

Posted 22 August 2012 - 02:37 PM

Hey, I have two classes in CSS:
• .table_hidden
• .table_left_column

I can't get the CSS selector to work to match this.

The selector:
.table_hidden .table_left_column
{ vertical-align: top; color: red; }

The HTML:
<table class="table_hidden">
<tr><td class="table_left_column">Stuff</td><td>Text</td></tr>
</table>

I'm expecting that, at the very least, the color of the text in the table should turn red - but it does not turn red.

Am I using the selector correctly?

It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.

All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.                                                                                                                                                       [Need free cloud storage? I personally like DropBox]

### #2Alpha_ProgDes  Crossbones+   -  Reputation: 4233

Like
1Likes
Like

Posted 22 August 2012 - 02:45 PM

Maybe
[source lang="css"]table.table_hidden > tr > td.table_left_column[/source]
? I believe it's something like that.

Edited by Alpha_ProgDes, 22 August 2012 - 06:29 PM.

Beginner in Game Development? Read here.

Super Mario Bros clone tutorial written in XNA 4.0 [MonoGame, ANX, and MonoXNA] by Scott Haley

If you have found any of the posts helpful, please show your appreciation by clicking the up arrow on those posts

Spoiler

### #3Madhed  Crossbones+   -  Reputation: 1582

Like
1Likes
Like

Posted 22 August 2012 - 03:37 PM

The selector looks correct.
Maybe you have another rule with a higher specificity that overwrites your selector?

What does firebug/whatever inspector you use show?

### #4Servant of the Lord  Crossbones+   -  Reputation: 12802

Like
1Likes
Like

Posted 22 August 2012 - 04:48 PM

</facepalm>

The CSS was working fine, but (being inline <style> CSS returned from a shortcode) WordPress was puking <p> and </p> every few lines, just to make sure the CSS wouldn't parse correctly.

Which is weird, because I am 85% sure I checked the generated HTML as one of the first things I did to debug it.

Thanks anyway, and sorry for wasting your time.

It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.

All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.                                                                                                                                                       [Need free cloud storage? I personally like DropBox]

### #5wicked357  Members   -  Reputation: 888

Like
1Likes
Like

Posted 23 August 2012 - 08:08 AM

I dont know if you intended for this to happen but what I get is Stuff is red the rest isn't. If you were going for it all to be red you are missing a comma in your css.
So instead of .table_hidden .table_left_column put a , inbetween them. If you intended on just stuff being red then why have .table_hidden in there at all? Just .table_left_column will do just fine.

Edited by wicked357, 23 August 2012 - 08:12 AM.

### #6Servant of the Lord  Crossbones+   -  Reputation: 12802

Like
0Likes
Like

Posted 23 August 2012 - 10:07 AM

Yes, the intention was that just "Stuff" is red. The reason why I needed ".table_hidden .table_left_column", was because I also have ".table_normal .table_left_column" and ".table_nice .table_left_column" - it's deliberate. Excellent catch though!

It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.

All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.                                                                                                                                                       [Need free cloud storage? I personally like DropBox]

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS