Mobile Friendly Website

CSSPLAY

Doing it with style

OPACITYPartial Opacity

Pre : 2006

For all browsers

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.

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.

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.

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.

Information

This is a very old demo that is kept on site for those starting out with CSS.

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).


Support CSSPLAY

Your donations keep CSS PLAY running.
If your donation is for the use of a demo then please email me with the demo url after making your donation.


For more CSS demonstrations
I recommend that you visit the Dynamic Drive CSS Library.


Free, practical CSS menus, layouts, and examples


CUSTOM SEARCH

Facebook Twitter rss feed Facebook Fan Page