"A css solution"(?) Every time I say yes or no absolutely someone comes along and shows that it's possible. You can use the hover feature of css to do this temporarily, but I don't think that can be changed to a permanent thing.
css could do this with the :target feature< but we have to change the html and add to the css;
Added to css:
Code:
div #top1:target {
background-color:#000066;
}
And the html looks like this:
Code:
<body>
<div id="container">
<div id="bot1"></div>
<a href="#top1"><div id="top1"></div></a>
</div>
</body>
But that did not bring the bot1 div to the top, it just changed the color of the top1 div. A magic trick.
BUT now we use z-index. So to the #bot1 css mark up we add:
Code:
z-index: 5;
color: white;
A z-index and we make text readable.
To the css :target we CHANGE it to:
Code:
div #top1:target {
z-index:3;
}
So it's z-index will change to less then bot1.
And we change this:
Code:
<div id="bot1">Bottom</div>
So we have something to prove bot1 came to the top.
The total comes out:
Code:
#bot1 {
width:25%;
height:100%;
position:absolute;
background-color:#000066;
top:0%;
left:0%;
z-index: 5;
color: white;
}
#top1 {
width:25%;
height:100%;
position:absolute;
background-color:#660000;
top:0%;
left:0%;
z-index:10;
}
div #top1:target {
z-index:3;
}
</style>
</head>
<body>
<div id="container">
<div id="bot1">Bottom</div>
<a href="#top1"><div id="top1"></div></a>
</div>
</body>
And yeah we get css to work on click and bring a div to the top.
Thanks for making do some research. But the javascript is the fastest way and only 2% of users have it turned off and the heck with them. They're probably paranoid and don't care if they see the whole web.
Code:
div #top1:target {
display:none;
}
Also works