Even odd CSS makes sense

by zemion
Posted in HTML, CSS, JS

How can you format CSS elements based on their position? Say, every second element should be aligned to the right, whereas the first and last element should behave differently? This post gives some insight on how to approach such a problem.

Imagine the following situation: You have a Javascript slider on a webside, let's say in a webshop. Take for instance the webshop of alnaVela, a vegan online store with a great range of products. (Disclaimer: I'm a co-owner of the shop) What I have done there is formatting every second element on the other side. It's all done in CSS, and when an element is added, the slider adjusts automatically.

Read further

Get your foot(er) on the ground!

by zemion
Posted in HTML, CSS, JS

When setting up this blog, I ran into a simple but common problem with the original theme: the footer was floating "mid-air" when the content was shorter than the page height.

The desired solution should not nail the footer to the bottom (fixing it, thus alway showing it independently of scrolling). Also, I was looking (for the n-th time) a CSS-only solution (well, including the necessary HTML sctructure).

Read further