HTML CSS examples for CSS Layout:Absolute Position
Make <div> scale to content when absolutely positioned
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> div {<!--from w w w .j ava 2s. c o m--> position:absolute; background:red; } p { width:100px; background:blue; text-align:center; } </style> </head> <body> <div> <p>Lorem ipsum</p> </div> </body> </html>