<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN"> <html> <head> <title>CSS Floats: Shrink Wrapped Right Floats With Right Aligned Text</title> <style> .control { display: inline; font: 1em/1 Ahem, sans-serif; background: red; color: white; } .container { width: 40%; padding: 0; margin: 1em; border: solid black; font: 2em/1 Ahem; height: 1em; width: 2em; background: red; } .test { text-align: right; float: right; clear: right; color: green; } </style> </head> <body> <p class="control">Ahem_font_required_for_this_test.</p> <p>The following two boxes should look identical.</p> <div class="container"> <div class="test">xx</div> </div> <div class="container"> <div class="test"> xx </div> </div> </body> </html>