Headings as images – The Lindsay method

Date: 1 August 2003
Author: Russ Weakley

There has been a lot written lately about how to use CSS-based images for headings in order to keep presentation seperate from content.

Apart from using inline images for headings, or the slightly more semantic option of wrapping these inline images inside HTML heading tags, there are many CSS-based and flash-based methods available. Each of them has advantages and disadvantages.

The Lindsay method

The Lindsay method uses existing elements as a starting point for CSS. The H3 is given a background image through CSS but the actual H3 text is still on the page, just hidden by making it very small, and of similar colour to the background of the image.

Advantages:

  • The image is seperate from the content so if no css support is present the HTML heading will display
  • There is no additional span or div tags required.
  • The text is still present on the page (not turned off via display: none), so it is searchable and readable by assistive technologies

Disadvantages:

  • User stylesheets can over-ride the tiny font size and cause the HX to display over the top of the background image
  • Users who come to the page with CSS supporting browsers but with images turned off will get no heading at all

HTML code

<h3 class="sample03">
	Heading here
</h3>

CSS code

.sample03
{
	width: 400px;
	height: 100px;
	background: url(heading.jpg) no-repeat;
	font-size: 1px;
	color: #fff; 
} 

Sample:

Comments are closed.