[thelist] CSS opacity question

Barney Carroll barney at textmatters.com
Wed Jul 11 11:55:00 CDT 2007


ben morrison wrote:
> Using 'universally unambiguous css' how will the background div know
> how wide/high it should be so that it will take up the same amount of
> space as the foreground (content) div (also consider text resizing)?
> 
> Generally we are taking about height as widths are more often used than heights.

The trick is to give the parent relative positioning, and both children 
(content and background) absolute positioning (which makes them 
dependent on the closest relative parent), and top, right, bottom and 
left values of 0. They will both hug the edges of their parent.

Because they are absolutely positioned there is no competition in the 2D 
flow of the page, and they can occupy the same horizontal and vertical 
space.


Regards,
Barney



More information about the thelist mailing list