Skip to main content
GameDev.net gamedev.net
🔒 Locked

[web] Use CSS to control other elements

Started by Genesiiis Nov 30, 2008 at 9:32 AM 3 replies 1.4k views
Original Post
Genesiiis
Genesiiis
Hi guys, I was wondering if using CSS say when you hover over a link, it can be used to control the styles of other elements. Obviously you could do that using &#106avascript, but I wanted to know if it was possible as I have never come across anything to suggest you could, thanks guys :D
acidwillburnyou
acidwillburnyou
Nope, CSS cannot do that. You are correct in saying that &#106avascript can. My personal favourite is JQuery's CSS selectors.
Genesiiis
Genesiiis
Thanks Karan, lol thought as much, oh well, yeh I think I have used the jQuery library before as well, thanks for the reply Karan :D
jbadams
jbadams
You can however still pull off some pretty cool tricks such as for example Pure CSS Popups (using images) and the like.

If you're after anything much more complex than that or proper style-changes on different elements you'll need a &#106avascript solution though.
- Jason Astle-Adams
Genesiiis
Genesiiis
Thanks jbadams, you know what I was just doing my own little experiments in using selectors in that exact way last night after I posted the thread, thanks for that :D, could I ask then is it possible to use as long a string of elements in a decedent selector for example using the following code :

<tag_1>    <tag_2 id="yes">         <tag_5 class="no">              <tag_6 id="maybe">              </tag_6>         </tag_5>    </tag_2>    <tag_3>    </tag_3></tag_1>tag_1 tag_2#yes tag_5.no tag_6#maybe {    CSS...}


would the CSS style correctly set the style for tag_6 or is there a finite number of elements that can be used in a selector :D

Thanks guys :D

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.