I am looking for a nice way to change the visibility of an HTML div.
The probably most common way to do this, is by using JavaScript, since it can manipulate my DOM. In my current project, I prefer not to use any JavaScript, so here is my question:
Is there another way to solve this, by using technologies like Ruby or Sass?
I am using in my project Ruby + the Sinatra Framework, as well as Haml and Sass.
display: noneis usually the preferred way of hiding an element as it completely removes the element instead of leaving a gaping hole likevisibility: hiddendoes. There is an element in HTML5 (details) that has a show/hide behavior, but it should only be used if it is appropriate semantic-wise (support is poor at the moment: Chrome/Safari only).