執行 ❯
建立您
自己的
網站
×
更改方向
儲存程式碼
更改主題,深色/淺色
前往 Spaces
<!DOCTYPE html> <html> <head> <style> div.a { position: relative; width: 400px; height: 200px; border: 3px solid red; } div.b { position: absolute; top: 0; border: 3px solid blue; } div.c { position: absolute; top: 50px; border: 3px solid green; } </style> </head> <body> <h1>The top Property</h1> <p>The following red div element has position: relative;</p> <div class="a"> <div class="b">This div element has position: absolute, and top: 0.</div> <div class="c">This div element has position: absolute, and is placed 50 pixels down from the top edge of the containing positioned element.</div> </div> </body> </html>