运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 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>