-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path08-Inline vs Block vs Inline-block.html
More file actions
41 lines (34 loc) · 1.05 KB
/
08-Inline vs Block vs Inline-block.html
File metadata and controls
41 lines (34 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>8 - Inline vs Block vs Inline-block</title>
<style>
/* Inline-block Example Style */
.box {
display: inline-block; /* Behaves like inline + block */
width: 100px; /* Width works */
height: 50px; /* Height works */
background: lightblue; /* Background color */
}
</style>
</head>
<body>
<!-- Block Elements Example -->
<!-- <p> and <div> are block elements -->
<p>This is a block element</p>
<div>It starts on a new line</div>
<hr />
<!-- Inline Elements Example -->
<!-- span is an inline element -->
<!-- width and height will NOT work here -->
<span style="background: black; color: white"> Hello </span>
<span>World</span>
<hr />
<!-- Inline-block Elements Example -->
<!-- div elements behaving as inline-block -->
<div class="box"></div>
<div class="box"></div>
</body>
</html>