CSS position:relative(相对)

cssweb developmentfront end technology更新于 2024/4/12 14:04:17

position:relative; 属性允许您将元素相对于其正常位置进行定位。您可以尝试运行以下代码来实现 CSS 位置:相对;

示例

<!DOCTYPE html>
<html>
   <head>
      <style>
         div {
            position: relative;
            left: 20px;
            border: 3px solid blue;
         }
      </style>
   </head>
   <body>
      <h1>Positioning Element</h1>
      <div>
         div element with position: relative;
      </div>
   </body>
</html>

输出


相关文章


有用资源