Skip to content

Commit 6f75e38

Browse files
committed
Display Property - block, inline
1 parent 27e3b6d commit 6f75e38

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

index.html

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@
44
<meta charset="UTF-8" />
55
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>CSS Box Model</title>
7+
<title>Display Property</title>
88

99
<!-- Stylesheet -->
1010
<link rel="stylesheet" href="./styles.css" />
1111
</head>
1212

1313
<body>
14-
<h2>hello world</h2>
15-
<h2>hello world</h2>
16-
<h2>hello world</h2>
17-
<h2>hello world</h2>
18-
<h2>hello world</h2>
19-
<h2>hello world</h2>
20-
<h2>hello world</h2>
21-
<h2>hello world</h2>
14+
<!-- Block elements -->
15+
<div class="block">I'm a block element</div>
16+
<h1 class="block">I'm a block element</h1>
17+
<p class="block">I'm a block element</p>
18+
19+
<!-- Inline elements -->
20+
<span class="inline">I'm an inline element</span>
21+
<a class="inline">I'm an inline element</a>
22+
<img src="./smoothie.jpg" alt="smoothie" width="100" class="inline" />
2223
</body>
2324
</html>

smoothie.jpg

293 KB
Loading

styles.css

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
/*
2-
Border Hack - to troubleshoot layout
2+
ELEMENTS HAVE IT SET BY DEFAULT
3+
BLOCK : Always starts a new line and spans full width
4+
INLINE : Does not start a new line and spans only content
35
*/
46

5-
* {
6-
border: 2px solid red;
7+
.block {
8+
background: blue;
9+
color: white;
10+
display: block;
11+
display: inline;
12+
}
13+
14+
.inline {
15+
background: red;
16+
color: white;
17+
display: inline;
18+
display: block;
719
}

0 commit comments

Comments
 (0)