Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> div { background-color: #8ebf42; height: 200px; width: 600px; position: relative; } p { margin: 0; color: #eee; position: absolute; border: 2px solid #666; } .ex1 { top: 0; } .ex2 { top: 50px; } </style> </head> <body> <h2>Top property example</h2> <div> <p class="ex1">Some text (top: 0;)</p> <p class="ex2"> Lorem ipsum is simply dummy text...(this text is positioned 50 pixels down from the top edge of the containing positioned element.) </p> </div> </body> </html>