I am sure it’s safe to say that most developers love to use the latest and greatest web tools available. Helpful resources such as preprocessors, template engines, syntax formatters - you name it - can all make a developer’s life easier. Unfortunately, this sometimes comes at a cost: the HTML structure.
This is why I try my best to write HTML as if I’m stuck with the constraints of the 90s (within reason). What does this mean exactly? It means that tables
are coded with table
elements. Navigations are coded with nav
and ordered/unordered list-items. Form inputs are not set with display: none
and replaced with custom containers. You know, semantic HTML.
To be clear, I’m not advocating for creating projects that look like they belong in the 1990s. I would just prefer developers / designers be more conscious of their HTML skeleton.
Let’s do a very simple breakdown of some of the more common HTML no-nos:
span
or div
elements for navigations or list componentsdiv
layouts for forms while removing items like select
or radio
div
elementsSo what should you do in place of these bad HTML implementations?
nav
, ul
and ol
for navigations or list componentstable
element structure (mind-blowing, I know!)I’ve found a pretty simple starting point for testing the bones of a website by using the following single line of CSS:
* {
border: 2px dotted black;
}
This property simply outlines all elements on the current page in a dotted border. By placing a border on every HTML element you can instantly see how overly complex or ugly your structure might be under the hood.
I know, this stuff is pretty basic. The point of this post isn’t to tell you (developers) something brand new or mind-blowing, but instead should inspire you to keep things simple.
Don’t forget that there is always someone new into the world of design and development. Hopefully this post steers others towards keeping HTML code semantic and clean. ✌️
Since this post received so much more attention than I ever expected, I’ve decided to touch on a few small points brought up in the comments.
flexbox
etc. (You can see responsive tables in action here)I'm extremely grateful for the support from the "Hall of Fame" supporters:
adast.dk
alessandrocuzzocrea.com
alexeystar.com
arc-x.org
artemislena.eu
b0ba.dev
cleberg.net
danielsada.tech
dieses-veganismus.de
gtrr.artemislena.eu
iosis-labs.com
jakobmagnusson.se
jamieonkeys.dev
kristianscott.co.uk
lukealexdavis.co.uk
miniskirt.me
nicksherman.com
simone.org
t0.vc
tedmagaoay.com
willem.com
wonger.dev
xslendi.xyz
zoraster.org
If you too would like to support this project and help fund more articles like this one:
Become a supporter today →