Computer >> คอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS

การวางตำแหน่งคงที่ใน CSS


ด้วยการวางตำแหน่งคงที่ องค์ประกอบจะไม่ได้รับผลกระทบจากคุณสมบัติด้านบน ด้านล่าง ด้านซ้าย และด้านขวา สำหรับสิ่งนี้ ให้ใช้ ตำแหน่ง:คงที่

ตัวอย่าง

เรามาดูตัวอย่างกัน −

<!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>

ผลลัพธ์

การวางตำแหน่งคงที่ใน CSS