skip to content

Partial Opacity

Method 1 - using Opacity

Mad Hatter's Tea Party

CHAPTER VII

A Mad Tea-Party

There was a table set out under a tree in front of the house, and the March Hare and the Hatter were having tea at it: a Dormouse was sitting between them, fast asleep, and the other two were using it as a cushion, resting their elbows on it, and talking over its head. `Very uncomfortable for the Dormouse,' thought Alice; `only, as it's asleep, I suppose it doesn't mind.'

Method 2 - using PNG Opacity (fails in IE - though can be made to work with javascript). Works in IE7.

Mad Hatter's Tea Party

CHAPTER VII

A Mad Tea-Party

There was a table set out under a tree in front of the house, and the March Hare and the Hatter were having tea at it: a Dormouse was sitting between them, fast asleep, and the other two were using it as a cushion, resting their elbows on it, and talking over its head. `Very uncomfortable for the Dormouse,' thought Alice; `only, as it's asleep, I suppose it doesn't mind.'

Method 3 - using two background images (works in all browsers)

Cheating really as this is not opacity.

Mad Hatter's Tea Party

CHAPTER VII

A Mad Tea-Party

There was a table set out under a tree in front of the house, and the March Hare and the Hatter were having tea at it: a Dormouse was sitting between them, fast asleep, and the other two were using it as a cushion, resting their elbows on it, and talking over its head. `Very uncomfortable for the Dormouse,' thought Alice; `only, as it's asleep, I suppose it doesn't mind.'

Methos 4 - using graduated PNG Opacity (fails in IE - see method 2) Works in IE7.

Mad Hatter's Tea Party

CHAPTER VII

A Mad Tea-Party

There was a table set out under a tree in front of the house, and the March Hare and the Hatter were having tea at it: a Dormouse was sitting between them, fast asleep, and the other two were using it as a cushion, resting their elbows on it, and talking over its head. `Very uncomfortable for the Dormouse,' thought Alice; `only, as it's asleep, I suppose it doesn't mind.'


Information

Placing text over an image can sometimes make it difficult to read, but with these methods the background for the text is made 'opaque' using various methods of opacity (including css3) and the black text is then quite readable.

Note that I have used two 'text' divs for method 1. One to hold the background opacity and the other to hold the text. If the text was placed in the same div as the opaque background then it too would become opaque.

Only one text div is required for methods 2, 3 and 4.

5th September 2006

Works in Internet Explorer 7 (RC1).

Copyright

You may use this method on your personal 'non-profit' web site without seeking my permission. A link back to CSSplay is always appreciated.

Commercial usage is also permitted without seeking approval, but I would ask that a donation is considered to support my work on CSSPlay.

If you are having problems integrating any of my demonstrations into your website then I now offer a service to fault find and correct any errors that you may have introduced. Please email me for more information.


CSS play recommend

Free, practical CSS menus, layouts, and examplesSitegrinderFlash LoadedSocial Media Applications On DemandBitrix Site ManagerPSD to HTML, PSD to XHTML Service by PSD2HTML.com. You Design - We XHTML / CSS.