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

CSS ถูกต้อง ทรัพย์สิน


คุณสมบัติที่ถูกต้องใช้เพื่อกำหนดตำแหน่งแนวนอนขององค์ประกอบ ถูกกำหนดเป็น −

right: auto|length|initial|inherit;

ตัวอย่าง

ให้เรามาดูตัวอย่างการใช้คุณสมบัติที่เหมาะสมใน CSS -

<!DOCTYPE html>
<html>
<head>
<style>
div {
   text-align: justify;
   text-justify: inter-word;
   color: white;
   background-color: orange;
   position: absolute;
   right: 90px;
}
</style>
</head>
<body>
<h2>Demo Heading</h2>
<div>This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. </div>
</body>
</html>

ผลลัพธ์

CSS ถูกต้อง ทรัพย์สิน

ตัวอย่าง

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

<!DOCTYPE html>
<html>
<head>
<style>
.demo {
   background-color:orange;
   width:100px;
   position:relative;
   right:0px;
   color: white;
}
</style>
</head>
<body>
<h1>Details</h1>
<div class="demo">Examination Center near ABC College.</p>
<div class="demo2">Exam begins at 11AM.</p>
</body>
</html>

ผลลัพธ์

CSS ถูกต้อง ทรัพย์สิน

ตัวอย่าง

ให้เราดูตัวอย่างที่มีค่าลบ -

<!DOCTYPE html>
<html>
<head>
<style>
.demo {
   background-color:orange;
   width:100px;
   position:relative;
   right:-100px;
   color: white;
}
</style>
</head>
<body>
<h1>Details</h1>
<div class="demo">Examination Center near ABC College.</p>
<div class="demo2">Exam begins at 11AM.</p>
</body>
</html>

ผลลัพธ์

CSS ถูกต้อง ทรัพย์สิน