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

แสดง Inline-Block โดยใช้ CSS


ชุดองค์ประกอบพร้อมการแสดงค่าคุณสมบัติบล็อกอินไลน์ใช้เพื่อแสดงองค์ประกอบเป็นคอนเทนเนอร์บล็อกระดับอินไลน์

ตัวอย่าง

ให้เราดูตัวอย่างการใช้ค่าคุณสมบัติบล็อกอินไลน์ใน CSS -

<!DOCTYPE html>
<html>
<head>
<style>
p {
   background-color: orange;
   color: white;
}
p.demo {
   display: inline-block;
}
</style>
</head>
<body>
<h1>Student Result</h1>
<div>
The result of MCA student will be declared on <p class="demo">20th Decemeber 2019</p>. Check the website on the same day at 8PM.
</div>
</body>
</html>

ผลลัพธ์

แสดง Inline-Block โดยใช้ CSS

ตัวอย่าง

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

<!DOCTYPE html>
<html>
<head>
<style>
p {
   background-color: orange;
   color: white;
}
p.demo1 {
   display: none;
}
p.demo2 {
   display: inline-block;
}
</style>
</head>
<body>
<h1>Match Details</h1>
<div>
Match will begin at <p class="demo1">9AM</p> 10AM on 20th December.
</div>
<div>
Match will end at <p class="demo2">5PM</p> on 20th December.
</div>
</body>
</html>

ผลลัพธ์

แสดง Inline-Block โดยใช้ CSS