Computer >> 컴퓨터 >  >> 프로그램 작성 >> CSS

CSS를 사용하여 인라인 블록 표시

<시간/>

display inline-block 속성 값으로 설정된 요소는 요소를 인라인 수준의 블록 컨테이너로 표시하는 데 사용됩니다.

예시

이제 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>

출력

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>

출력

CSS를 사용하여 인라인 블록 표시