CSS Selecting Help
- Started
- Last post
- 11 Responses
- ethios
Hi gang, just wondering how I would select a table which contains a td whose class="post"
There are other tables but I only want to affect the ones which contains a td whose class"post"
Before you say anything, I cannot edit the code, is this possible using attribute selectors or something? I read about it somewhere.
Any help is appreciated guys!
-Tom
- instantok0
what do you need to do with the table?...are you just applying a style?...if so then in the style sheet just use:
.post {
styles here
}this will only affect the TDs with the post class though
- ethios0
I need to style the table CONTAINING the td whose class is "post"
Does that make any sense?
- instantok0
yes it makes sense...you will need to use javascript but i think it might get a bit sticky...you can't edit the source to add another class to the tables?
- ethios0
I'm thinking I may have to. Is what I'm looking for called parent selectors?
- ethios0
CSS3 eh?
- spiralstarez0
hey,
you might be able to do it with a parent selector method, depends on how your markup is.
Is the table contained in any other divs or classes?
Can you show the markup?
- ethios0
The table is contained within a div called #body_container
#body_container -> table -> td.post
- spiralstarez0
ok no probs then...
you can use the css like this:
#body_container table td {
my styles for the td tag
}but then if you only want to style the specific one:
#body_container table td.post {
my styles for the td tag
}is that what you are trying to do?
- ethios0
No, nevermind I edited the code, but iI was trying to us eparent selectors, I mentioned numerous times htat it is not the TD I want to style, but instead the table that CONTAINS the td
- spiralstarez0
yes ok, still the same methodology...
#body_container table {
my styles for the entire table
}