Re: [WSG] Style a parent element based on an id selector of the child element
Can't you make the a fill the entire td? i think it's display:block? then the background of the link will look like it fills the table cell.
[WSG] Style a parent element based on an id selector of the child element
Hello, are you able solve this dilemma for me? Is there a way to style the td element with a background colour if an a element has a active_menu id? table tr tda href="" id="active_menu"Link/a/td /tr/table Thanks,Martin
Re: [WSG] Style a parent element based on an id selector of the child element
On Wed, 2005-09-14 at 16:56 +0800, Martin Smales wrote: Is there a way to style the td element with a background colour if an a element has a active_menu id? No, CSS Selectors don't allow this. They can only step down, not up. You could do the equivalent in JavaScript, or... well, a long term strategy might be lobby browser makers to support XPath or something. So basically I don't have any good advice for you. .Matthew Cruickshank http://holloway.co.nz/ ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
Re: [WSG] Style a parent element based on an id selector of the child element
Martin, that's not possible all selectors work the other way around. You could assign a class or, if you don't need it for other things, the id to the td tag. If this isn't possible on the server side, use javascript to do so. regards, Martin am Mittwoch, 14. September 2005 um 10:56 schrieben Sie: Is there a way to style the td element with a background colour if an a element has a active_menu id? ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
RE: [WSG] Style a parent element based on an id selector of the child element
As Matthew said, the selectors step down, so you could apply the active_menu id to the td, then use descendence(!) on the contained elements. td id=active_menuasnip/a/td #active_menu { styles } #active_menu a { styles } Regards Scott Swabey Lafinboy Productions www.lafinboy.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matthew Cruickshank Sent: Wednesday, 14 September 2005 7:16 PM To: wsg@webstandardsgroup.org Subject: Re: [WSG] Style a parent element based on an id selector of the child element On Wed, 2005-09-14 at 16:56 +0800, Martin Smales wrote: Is there a way to style the td element with a background colour if an a element has a active_menu id? No, CSS Selectors don't allow this. They can only step down, not up. You could do the equivalent in JavaScript, or... well, a long term strategy might be lobby browser makers to support XPath or something. So basically I don't have any good advice for you. .Matthew Cruickshank http://holloway.co.nz/ ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help ** ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
Re: [WSG] Style a parent element based on an id selector of the child element
G'day Is there a way to style the td element with a background colour if an a element has a active_menu id? As others have said, you;d need to resort to JavaScript to do this, or change the setup so the id is on the container you want to change. One thing though... Is this in a data table or is part of a navigation list? If the latter, I'd use a list (ul or ol) rather than a table. Regards -- Bert Doorn, Better Web Design http://www.betterwebdesign.com.au/ Fast-loading, user-friendly websites ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **