ต่างจากบล็อก องค์ประกอบแบบอินไลน์เริ่มต้นในบรรทัดเดียวกันและใช้ความกว้างที่กำหนดเท่านั้น ให้เรามาดูตัวอย่างการใช้งาน display:inline property value ใน CSS −
ตัวอย่าง
เรามาดูตัวอย่างกัน −
<!DOCTYPE html>
<html>
<head>
<style>
span {
background-color: orange;
color: white;
}
p.demo {
display: none;
}
span.demo1 {
display: inline;
}
</style>
</head>
<body>
<h1>Match Details</h1>
<div>
Match will begin at <p class="demo">9AM</p> 10AM on 20th December.
</div>
<div>
Match will end at <span class="demo1">5PM</span> on 20th December.
</div>
</body>
</html> ผลลัพธ์

ตัวอย่าง
เรามาดูตัวอย่างอื่นกัน −
<!DOCTYPE html>
<html>
<head>
<style>
span#demo {
background-color:orange;
color: white;
display:inline;
}
</style>
</head>
<body>
<h1>Match Details</h1>
<div>
Match will begin at <span id="demo">9AM</span> on 20th December.
</div>
</body>
</html> ผลลัพธ์
