源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>编程字典</title> <style> div.relative { position: relative; left: 30px; border: 3px solid #73AD21; } </style> </head> <body> <h2>position: relative;</h2> <p>position: relative; 相对于其正常位置定位:</p> <div class="relative"> 这个 div 元素有 position: relative; </div> </body> </html>
运行结果