Let’s say we’ve the following mockup to implement with in our web application:
Extremely easy to implement with absolute positioned elements, but still quite challenge with relative/static elements. Would you still consider to refactor and how?
Great question! I had a good bit of fun toying with your jsfiddle. My optimized code is below — it uses more-or-less the same positioning though.
Fact of the matter is that if you want something that stretches vertically with the viewport, you need to use JS or absolute positioning, and I don’t think there’s anything wrong with that — I’ve worked on apps that use absolute positioning for the main layout, and floats/inline content within that layout.
HTML
<body>
<header>aaa | bbb | ccc</header>
<aside>Fixed Width Navigation</aside>
<div class="content">
<h2>Some Form here</h2>
<footer>
<input type="submit" value="Always at the bottom"></input>
</footer>
</div>
<footer>ccc</footer>
</body>