ArticleslgStudy

science

CSS image replacement

CSS image replacement is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand CSS image replacement rather than just read about it. In short: CSS image replacement is a dated web design technique that uses Cascading Style Sheets – as opposed to other technologies, like Flash – to replace text on a web page with an image containing that text. It is intended to keep pages accessible to users of screen readers, text-only web browsers, or other browsers where support for images or style sheets was either disabled or nonexistent, while allowing the image to di…

Key takeaways

  • CSS image replacement belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect CSS image replacement to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of CSS image replacement from memory before moving on to harder problems.

Reference excerpt

CSS image replacement is a dated web design technique that uses Cascading Style Sheets – as opposed to other technologies, like Flash – to replace text on a web page with an image containing that text. It is intended to keep pages accessible to users of screen readers, text-only web browsers, or other browsers where support for images or style sheets was either disabled or nonexistent, while allowing the image to differ between styles. One of many techniques was the Fahrner image replacement, named after Todd Fahrner, who was credited with the idea of image replacement in 2003. With the introduction of CSS web font support in all major web browsers, CSS image replacement is now little used.

Motivation The typical method of inserting an image in an HTML document is via the <img> element. This method has its drawbacks with regards to accessibility and flexibility, however:

While the alt attribute is designed for providing a textual representation of the image content, this precludes the use of HTML markup in the textual representation. Using the <img> element to show text is presentational. Many web designers argue that presentational elements should be separated from HTML content by placing the former in a CSS style sheet. Images referenced using an <img> element cannot be easily changed via CSS, causing problems with alternative presentations. Image replacement techniques like Fahrner image replacement were devised to rectify these issues.

Implementations The original Image Replacement implementation described by Douglas Bowman used a heading, inside of which was a <span> element containing the text of the heading:

Through style sheets, the heading was then given a background containing the desired image, and the <span> hidden by setting its display CSS property to none:

It was soon discovered, however, that this method caused some screen readers to skip over the heading entirely, as they would not read any text that had a display property of none. The later Phark method, developed by Mike Rundle in 2003, instead used the text-indent property to push the text out of the image's area, addressing this issue:

The Phark method had its own problems, however; in visual browsers where CSS was on but images off, nothing would display. Also in 2003, Dave Shea's eponymous Shea method solves both of the issues earlier mentioned, at the cost of an extra <span>:

By absolutely positioning an empty <span> over the text element, the text is effectively hidden. If the image fails to load, the text behind it is still displayed. For this reason, images with transparency cannot be used with the Shea method.

Over a dozen different methods has since been developed with varying degree of compatibility and complexity.

References

External links Revised Image Replacement – an overview of the various FIR techniques by Dave Shea Ultimate Image Replacement – a comprehensive image replacement technique by Jesse Schoberg Nine Techniques for CSS Image Replacement – a 2008 overview of techniques by web design magazine CSS-Tricks

Worked examples

Example 1 — a first encounter with CSS image replacement

Start with the simplest possible case. Write down what CSS image replacement claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to CSS image replacement before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about CSS image replacement ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of CSS image replacement

In research
CSS image replacement appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses CSS image replacement in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
CSS image replacement is common in secondary-school and first-year university syllabi. It links to neighbouring topics Cascading Style Sheets, Web design, so understanding it makes those chapters shorter.
In everyday life
Look for CSS image replacement outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “CSS image replacement” →

How to study CSS image replacement in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what CSS image replacement means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain CSS image replacement out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is CSS image replacement in simple terms?

CSS image replacement is a dated web design technique that uses Cascading Style Sheets – as opposed to other technologies, like Flash – to replace text on a web page with an image containing that text. It is intended to keep pages accessible to users of screen readers, text-only web browsers, or ot…

Why does CSS image replacement matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study CSS image replacement?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on CSS image replacement.

Tags

  • Cascading Style Sheets
  • Web design

Keep exploring