#1
  1. Plays with fire
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2003
    Location
    Barsoom
    Posts
    941
    Rep Power
    96

    :hover to target a different ID


    Ack. Never mind. I see this is a JS solution. CSS isn't up to it yet.
    Last edited by Frank Grimes; January 2nd, 2013 at 10:46 AM.
    “Be ashamed to die until you have won some victory for humanity.” -- Horace Mann

    "...all men are created equal." -- US Declaration of Independence
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,122
    Rep Power
    4258
    It depends on the document structure. Sometimes you can use the "+" (adjacent sibling) or "~" (general sibling) "combinators" to do that.

    However, yes, I would almost always use JavaScript for interactive features like that.

    CSS isn't up to it yet.
    Certain kinds of CSS selectors do not exist due to the way that CSS parsers work. To make certain selectors possible, e.g. a parent selector, would require the CSS parsers to do a lot more work.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  4. #3
  5. Plays with fire
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2003
    Location
    Barsoom
    Posts
    941
    Rep Power
    96
    To be clear, I am looking to change a parent's attributes from a child element. Just really not wanting to load some JS for one silly feature.
    “Be ashamed to die until you have won some victory for humanity.” -- Horace Mann

    "...all men are created equal." -- US Declaration of Independence
  6. #4
  7. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,122
    Rep Power
    4258
    Yes, CSS can't do that by itself.

    Just really not wanting to load some JS for one silly feature.
    Are you implying the use of a library, like jQuery? For something that simple, you do not need one, as long as you load the script at the end of the page instead of from in the <head>.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  8. #5
  9. Plays with fire
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2003
    Location
    Barsoom
    Posts
    941
    Rep Power
    96
    I wouldn't need jquery for this. A few simple JS lines would do it, but I'm being hardcore about reducing overhead.

    Actually, this pretty much solved my problems:

    http://net.tutsplus.com/tutorials/ht...rop-down-menu/

    Knowing I can put a <div> in a <li> tag is helpful. Rewrote my menu and it's working fine in IE, FF, Chrome and Safari on Mac and PC.

    I still believe CSS should have a method for selecting parents from children even it's creating more work for the engine. It just seems to belong there and eliminate the need for a second engine to perform a similar task. What do you think?
    “Be ashamed to die until you have won some victory for humanity.” -- Horace Mann

    "...all men are created equal." -- US Declaration of Independence
  10. #6
  11. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,122
    Rep Power
    4258
    That looks like a pretty good tutorial (but it's got a strange error of "rightright" repeated multiple times).

    Knowing I can put a <div> in a <li> tag is helpful.
    You didn't know that? I guess you're the type who does not use the specs as a reference?

    I still believe CSS should have a method for selecting parents from children even it's creating more work for the engine. It just seems to belong there and eliminate the need for a second engine to perform a similar task. What do you think?
    Sure it would be useful, but like I said there are other issues involved. However, the current draft of CSS4 Selectors seems to provide a mechanism for that. Scroll down to the bottom of the overview table: http://dev.w3.org/csswg/selectors4/#overview

    I think an ":nth-of-class()" and ":nth-of-attributeX()" would be useful too, but they haven't been created yet.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  12. #7
  13. Plays with fire
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2003
    Location
    Barsoom
    Posts
    941
    Rep Power
    96
    Originally Posted by Kravvitz
    You didn't know that? I guess you're the type who does not use the specs as a reference?
    *snicker*

    Well, I do actually. The thing is I've been stuck in a rut and seem to be making the same website over and over and over ... ad infinitum. My clients all seem to want the same time and this has never come up before.

    I have been keeping an eye on the CSS4 specs and waiting for this kind of selection.

    When I first started developing sites I was all excited about the newest and greatest technologies, but it wasn't long after I discovered the newest thing isn't always the greatest thing and support for it was slow coming.

    Even now, I see a huge drop in requests for Flash since my clients all seem to believe HTML 5 will replace it. When I explain the differences, I get mixed reactions from me being crazy to disappointment to general understanding.

    Still, I'm glad to look at what's coming and tinker more than I have been.
    “Be ashamed to die until you have won some victory for humanity.” -- Horace Mann

    "...all men are created equal." -- US Declaration of Independence
  14. #8
  15. Administrator
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Location
    Troy, NY
    Posts
    47
    Rep Power
    10
    HTML 5 Does not replace Flash when Flash doesn't belong on the web in the first place. HTML 5 has a a lot of hype yes, and yes you should probably be writing sites in 5 today. Many features are down the road but cannot not think of a god reason to not use the semantics and more basic stuff today.
  16. #9
  17. Plays with fire
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2003
    Location
    Barsoom
    Posts
    941
    Rep Power
    96
    Agreed, but Flash still provides features even JavaScript can't perform. It got a bad rep from years of misuse and a lack of serious promotion from Adobe and Macromedia.
    “Be ashamed to die until you have won some victory for humanity.” -- Horace Mann

    "...all men are created equal." -- US Declaration of Independence

IMN logo majestic logo threadwatch logo seochat tools logo