Quick Question about css selectors

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
smudge
Forum Contributor
Posts: 151
Joined: Sun May 20, 2007 12:13 pm

Quick Question about css selectors

Post by smudge »

Ok, I've looked around and can't seem to find the answer.
In CSS, how do you select the inverse of td#body p.indent ?
In other words, how do you select everything BUT paragraphs with the class indent?

And while I'm at it, how do you get a table to extend to the bottom of the screen?
height:100% doesn't seem to work, or at least in all situations.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: Quick Question about css selectors

Post by superdezign »

smudge wrote:Ok, I've looked around and can't seem to find the answer.
In CSS, how do you select the inverse of td#body p.indent ?
In other words, how do you select everything BUT paragraphs with the class indent?
You can't. The 'C' in CSS is 'cascading,' and the entire concept is based on inheritance. You could define the other styles, and the redefine the one you don't want to change to look like it did before.

Code: Select all

.class * {
/* Styles for everything else */
}

.class p.indent {
/* Styles for this particular element */
}
smudge wrote:And while I'm at it, how do you get a table to extend to the bottom of the screen?
height:100% doesn't seem to work, or at least in all situations.
Percentages only work when the containing element has a set size.
smudge
Forum Contributor
Posts: 151
Joined: Sun May 20, 2007 12:13 pm

Post by smudge »

Yeah, I had a major duh moment half an hour after I posted when I realized that, and already fixed it, but wanted to leave the question standing just in case :D
As for the table, I've done sites before where I can get a row in a table to hug the bottom of the screen, but when I went back to check, I couldn't see how I did it.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: Quick Question about css selectors

Post by superdezign »

superdezign wrote:Percentages only work when the containing element has a set size.
Have you tried sizing the HTML and BODY elements? Maybe try a height:100% on both and see what you get.
User avatar
iknownothing
Forum Contributor
Posts: 337
Joined: Sun Dec 17, 2006 11:53 pm
Location: Sunshine Coast, Australia

Post by iknownothing »

smudge wrote: As for the table, I've done sites before where I can get a row in a table to hug the bottom of the screen, but when I went back to check, I couldn't see how I did it.
Heres something that will do it, Pity about IE6 but...

Code: Select all

position: fixed; // IF you want it to never move
bottom:0px; //On the bottom, obviously...
Post Reply