Skip to content

Commit 4bc1425

Browse files
committed
Display Property - Basic Horizontal Centering
1 parent 6f75e38 commit 4bc1425

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

styles.css

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
/*
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
2+
HORIZONTAL CENTERING
53
*/
64

75
.block {
86
background: blue;
97
color: white;
10-
display: block;
11-
display: inline;
8+
width: 300px;
9+
margin: 2rem auto;
10+
/* margin-left: auto; */
11+
/* margin-right: auto; */
1212
}
1313

1414
.inline {
1515
background: red;
1616
color: white;
17-
display: inline;
18-
display: block;
17+
}
18+
19+
body {
20+
text-align: center;
1921
}

0 commit comments

Comments
 (0)