User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » CSS selector question - assign parent from child? Page [1]  
Noen
All American
31346 Posts
user info
edit post

So I have something like


<div class="parent"><input class="child"/></div>


Is there any way, with just CSS to set a parent property based on the child state?

Basically I want to do:

.child:focus < .parent { border: 1px solid black; }

But it looks like CSS will only do descendant inheritance?

[Edited on June 30, 2011 at 7:41 PM. Reason : stupid code]

6/30/2011 7:40:26 PM

Ernie
All American
45943 Posts
user info
edit post

Can't do it with CSS. Use jQuery.

6/30/2011 7:41:35 PM

Noen
All American
31346 Posts
user info
edit post

Fuck. Thanks Ernie

I know it's a simple event binding in jQuery, but man I was hoping to avoid that. If it's CSS I can avoid a whole lot of sign-offs and code reviews

6/30/2011 7:42:53 PM

FroshKiller
All American
51913 Posts
user info
edit post

That is, like, the exact opposite of cascading inheritance, son.

6/30/2011 8:58:12 PM

BigMan157
no u
103354 Posts
user info
edit post

I wish, qualified selectors would be sweet

6/30/2011 9:06:11 PM

lewisje
All American
9196 Posts
user info
edit post

Quote :
"Can't do it with CSS. Use jQuery."
c'mon, man up

roll your own straight-up jscript

6/30/2011 9:34:17 PM

qntmfred
retired
40812 Posts
user info
edit post

I do all my web development with punch cards

6/30/2011 9:38:33 PM

lewisje
All American
9196 Posts
user info
edit post

wait wait wait you can send punch cards down the intertubes

7/1/2011 6:30:39 AM

 Message Boards » Tech Talk » CSS selector question - assign parent from child? Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.