使用 CSS 显示内联块元素
cssweb developmentfront end technology更新于 2024/11/5 21:00:17
设置了 display inline-block 属性值的元素用于将元素显示为内联块容器。
示例
现在让我们看一个在 CSS 中实现 inline-block 属性值的示例 −
<!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>
输出

示例
现在让我们看另一个例子 −
<!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>
输出

相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

