Jump to content

Parent/sibling Selectors?


casper3912
 Share

Recommended Posts

myspace doesn't allow users to implement javascript. so i'm trying to find a way to use only css to display a section based off of a clicked link. i'm curious if theres a way to change the class of a visited link to non-visited(so that it can be hidden again), and also if theres a way to relate a link in an unordered list to a div that is a sibling to the unordered list.right now all i have is this:

/*first idea, doesn't work in IE*/div{display:none;}a:visited + div {display:block;}/*second idea, this allows it to be hidden again at least */a {text-decoration:none;}a span{display:none;}a:hover span{display:block;}/*third idea*/a {text-decoration:none;}a span {display:none;}a:visited span{display:block}

hmmm... and i just got another idea. i'll post it if it goes well.

Edited by casper3912
Link to comment
Share on other sites

this does exactly what i want it to do in IE, in fire fox the span isn't displayed as none for some reason, and when you mouse over it, the span that is supposed to be display none, has a interesting flutter effect. CSS

ul li a{text-decoration:none;}ul li a span {display:none;}ul li a:hover span{display:block;position:absolute; top:20%; left:30%;}

HTML

<ul><li>4th idea </li><li><a href="#">test me<span>testing 4th idea</span></li></ul>

any idea why its not working correctly in fireFox? and how i can fix it.

Link to comment
Share on other sites

ok, thanks i forgot the closing tag. it does help. i find typing out the problems i'm having to you guys, help me solve them myself, sometimes right after i type something and post it, i get an idea or figure it out myself. i think its just the process of making it presentible and going through it throughly enough that someone else could understand it, it makes me look at it 10 times and in a different perspective and mode of thought.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...