--- title: >- Neat HaCSS, or let's de-JS the Web a bit date: 2014-01-26 03:15 modified: 2014-01-26 03:15 lang: en authors: rysiek tags: - ancient - web-development - nojs - howto status: published pinned: false --- I like playing with technology, and I am particularly fond of playing with CSS/HTML. Not a big fan of JavaScript, though. Don't get me wrong, I understand the utility of JavaScript, and the power of [jQuery](https://jquery.com/), I really do. However, I believe both are overused and abused -- much, if not most, of functionality of "rich Internet applications" (also known simply as "websites"), including [transitions](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_transitions), [animations](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_animations) and [whatnot](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Flexible_boxes), can be implemented in [HTML5](https://en.wikipedia.org/wiki/HTML5) and [CSS3](https://en.wikipedia.org/wiki/CSS3#CSS_3), with JS used for [AJAX](https://en.wikipedia.org/wiki/Ajax_(programming)) requests. The advantages being: faster processing, smoother animations, more readable code, better separation of logic and presentation. Lately I dived into 2 side-projects that allowed me to dust-off my CSS-fu while making a point about how JS is becoming less and less needed as far as presentation layer is concerned. ## Sailing in the Cloud The first little project is [Sailors.MD](http://sailors.md/), a simple website for my sailors-and-medical-professionals friends. The second one is implementing something [ownCloud](http://owncloud.org) (that great little project letting everyone self-host their own "cloud") once had had that has later sadly been removed: [sharing calendars and events publicly via a link with a token](https://github.com/owncloud/apps/issues/411), or "link-sharing". I know of at least one potential deployment where that was a show-stopper. So after [complaining](/en/112) for a few months [I decided to implement it myself](https://git.hackerspace.pl/rysiek/owncalendar/). ## JS-in-a-dropbox Sailors.MD was a no-brainer -- a completely new project, a simple static website (that will grow, some day, but not just yet), no magical mumbo-jumbo, it just needs to look nice and be functional. No JS needed there, period! Now, ownCloud, on the other hand... JavaScript. JavaScript everywhere! Hacking together a nice CSS/HTML-based interface for internal- and link-sharing of calendars and events, with JS providing just the bare minimum of AJAX-ness, stemmed from the [frustration of debugging JavaScript-based interface](https://github.com/owncloud/apps/issues/411#issuecomment-32293464). ## The ~~Problem~~ Challenge I wanted the interface to retain full functionality -- including animations, showing/hiding parts of the interface, etc -- even without JavaScript enabled. There were several things that needed implementing in pure CSS/HTML, which seemed hard without JS: - sections of the interface collapsing/extending upon click... - ...that are both directly linkable (i.e. via [`:target`](https://developer.mozilla.org/en-US/docs/Web/CSS/:target) links), and persistent, allowing the user to interact with their contents and sub-sections; - showing some controls *only* when JS is *enabled* (a *reverse-`