Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Example of Clearing Floats</title> <style> .container{ float: left; background: yellow; border: 1px solid #c4884d; } p { width: 200px; margin: 10px; padding: 10px; } .red { float: left; background: #ff0000; } .green { float: right; background: #00ff00; } </style> </head> <body> <div class="container"> <p class="red">Floated to left.</p> <p class="green">Floated to right.</p> </div> </body> </html>