HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link name="favicon" type="image/x-icon" href="https://skillzam.com/uploads/system/e353194f3b7cd1b75d69c3ab88041985.png" rel="shortcut icon" />
<title>Display - Inline Block</title>
<style>
.spanInline {
display: inline; /* the default for span */
width: 200px;
height: 200px;
padding: 5px;
border: 1px solid black;
background-color:cornflowerblue
}
.spanBlock {
display: block;
width: 200px;
height: 200px;
padding: 5px;
border: 1px solid black;
background-color: cornflowerblue;
}
.spanInlineBlock {
display: inline-block;
width: 200px;
height: 200px;
padding: 5px;
border: 1px solid black;
background-color: cornflowerblue;
}
</style>
</head>
<body>
<!--
display: inline-block - allows to set a width & height on element & top/bottom margins/paddings are respected ( Compared to display: inline )
display: inline-block - does not add a line-break after element, so element can sit next to other elements ( Compared to display: block )
-->
<h1>Demo: Display (inline-block)</h1>
<h2>Demo inline display</h2>
<div> Lorem ipsum dolor sit amet consectetur adipisicing elit. Maiores accusantium, ut fugit numquam sunt saepe veritatis, tempora, repudiandae dolore ullam voluptas ex velit nisi pariatur illo ducimus tempore animi natus!
<span class="spanInline"> -Skillzam learning- </span>
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Officia magnam aperiam illum possimus tenetur, maiores eveniet, tempora quod laboriosam nemo doloribus officiis minus. Ut impedit corporis illum aliquid. Ipsum, quisquam?
</div>
<hr>
<h2>Demo block display</h2>
<div> Lorem ipsum dolor sit amet consectetur adipisicing elit. Maiores accusantium, ut fugit numquam sunt saepe veritatis, tempora, repudiandae dolore ullam voluptas ex velit nisi pariatur illo ducimus tempore animi natus!
<span class="spanBlock"> -Skillzam learning- </span>
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Officia magnam aperiam illum possimus tenetur, maiores eveniet, tempora quod laboriosam nemo doloribus officiis minus. Ut impedit corporis illum aliquid. Ipsum, quisquam?
</div>
<hr>
<h2>Demo inline-block display</h2>
<div> Lorem ipsum dolor sit amet consectetur adipisicing elit. Maiores accusantium, ut fugit numquam sunt saepe veritatis, tempora, repudiandae dolore ullam voluptas ex velit nisi pariatur illo ducimus tempore animi natus!
<span class="spanInlineBlock"> -Skillzam learning- </span>
Lorem ipsum dolor sit, amet consectetur adipisicing elit. Officia magnam aperiam illum possimus tenetur, maiores eveniet, tempora quod laboriosam nemo doloribus officiis minus. Ut impedit corporis illum aliquid. Ipsum, quisquam?
</div>
</body>
</html>