<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> <html lang="en"> <head> <title>Replaced inline elements with % widths</title> <style type="text/css"> div.a { width: 300px; height: 100px; background: red; } div.a p { width: 200%; } div.a img { width: 50%; height: 100px; vertical-align: bottom; } div.b { width: 300px; position: relative; } div.b p { width: 200%; } div.b img { width: 50%; height: 100px; vertical-align: bottom; } div.b span { position: absolute; top: 0; left: 0; background: green; width: 300px; height: 100px; } </style> </head> <body> <p>There should be no red below, just two 300×100 pixel green rectangles of different shades, seperated by 1em of margin.</p> <div class="a"> <p> <img src="/resources/images/1x1-green" alt="Image support required for this test"> </p> </div> <div class="b"> <p> <img src="/resources/images/1x1-red" alt="Image support required for this test"> <span></span> </p> </div> </body> </html>