What is the cleverest CSS technique that lets you use less HTML?
One of the advantages of using CSS well is that it can let you simplify your HTML, and produce look-and-feel effects entirely in the CSS. In the beginning this was just replacing deprecated HTML presentation mark-up and spacer-GIFs with CSS, but recent years have shown more good ideas.
I am looking for something less obvious than the following.
- Replace HTML
HR
with CSSborder
, for separating sections that are already DIVs. - Replace HTML
IMG
with CSSbackground-image
, for graphics that are not 'content'. - Replace HTML text with CSS
:before
andcontent
, for text that is not 'content'.
I am not looking for techniques that involve adding JavaScript or more HTML, such as additional DIV elements.
Techniques that only work in specific browsers and versions are okay, provided that you say which ones.