CSS 中的静态定位

cssweb developmentfront end technology更新于 2024/11/29 1:16:17

静态定位使元素不受 top、bottom、left 和 right 属性的影响。为此,请使用 position: static

示例

现在来看一个例子 −

<!DOCTYPE html>
<html>
<head>
<style>
div.static {
   position: static;
   color: white;
   background-color: orange;
   border: 2px dashed blue;
}
</style>
</head>
<body>
<h2>Demo Heading</h2>
<p>This is demo text.</p>
<p>This is demo text.</p>
<div class="static">
position: static;
</div>
<p>This is another demo text.</p>
</body>
</html>

输出


相关文章


有用资源