HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> div{ position: relative; border: 1px solid black; height: 250px; } img{ position: absolute; top: 15%; } </style> </head> <body> <h1>CSS top Property</h1> <p>This is first paragraph.</p> <p>This is second paragraph.</p> <p>This is third paragraph.</p> <div> <img src="apple.png"> </div> <p><strong>Note</strong>: Image starts from 10% from the start of the div. Try to remove div's position: relative and click 'run' button.</p> </body> </html>
OUTPUT
×

Save as Private