Display Inline-Block using CSS

CSSWeb DevelopmentFront End Technology

The element set with display inline-block property value is used to display an element as an inline-level block container.

Example

Let us now see an example to implement inline-block property value in CSS −

 Live Demo

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

Output

Example

Let us now see another example −

 Live Demo

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

Output

raja
Published on 27-Dec-2019 10:15:22
Advertisements