I'm looking for the simplest way to achieve a type of layout that looks simple:
...but actually involves a lot of criteria, many of which involve non-trivial CSS issues:
- Vertically centred content in a div...
- ...where the content is of variable length (so distance from top and bottom can't be hard coded)...
- ...where the div is inside a selection of floated divs...
- ...where those divs have percentage widths to fill the screen on a responsive layout...
- ...where there is a fixed pixel gap between each div...
- ...where the divs have solid background colours or images and the background behind the divs isn't a known solid colour that can be re-applied
Various elements of this have been addressed in separate questions (for example vertically aligning floated divs, and pixel gaps between responsive percentage-width divs), but I couldn't find anything combining them.
Simplest means:
- As few HTML wrappers as possible
- Minimal extra Javascript (none if possible)
- Minimal CSS that needs to change when breakpoints change the number of divs on each row
- Minimal code, quirks, or fragile CSS trickery (e.g. relying on browser quirks that could change in future)
- Minimal cross browser issues (ideally, should work on IE8+ with minimal IE-specific markup)