I am very new to web design, and specially to technologies like css3 and html5,
I want to built a website that will use as much as possible CSS3 and HTML5 and as less as possible JavaScript.
So I want to get pretty much the same behavior using only CSS/HTML.
$(document).ready(function () {
$("#wrapper section").click(function() {
var bcn = $(this).next('.box-content');
if ($('.box-content').is(':visible')) {
$('.box-content').hide();
bcn.show();
}
else {
$('.box-content').hide();
bcn.slideToggle(200);
}
});
});
That’s what I want to make without JS: http://jsfiddle.net/8BLD7/7/
This is roughly approximate to the code you have there, obviously as others have stated this will only work in modern browsers—I wouldn’t recommend purely using this system—but it is something that can be worked in as a progressive enhancement as mentioned by War10ck.
http://jsfiddle.net/3VQ9X/
For futher information on how this works, and the issues to be aware of read these links:
Here’s the markup and css involved.
markup
css (basic element setup, can be modified as you like)
css (the magic bit)