Skip to content

Commit 96901c9

Browse files
committed
Display Property - Mobile Navbar Example
1 parent 4bc1425 commit 96901c9

File tree

2 files changed

+30
-22
lines changed

2 files changed

+30
-22
lines changed

index.html

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,11 @@
1111
</head>
1212

1313
<body>
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" />
14+
<ul class="navbar">
15+
<li><a href="#">home</a></li>
16+
<li><a href="#">contact</a></li>
17+
<li><a href="#">products</a></li>
18+
<li><a href="#">about us</a></li>
19+
</ul>
2320
</body>
2421
</html>

styles.css

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,32 @@
11
/*
2-
HORIZONTAL CENTERING
2+
BLOCK:browser respects width/height, top/bottom margin
3+
INLINE:browser does not respect width/height,
4+
top/bottom margin
5+
Navbar
6+
list-style-type:property
7+
descendant selectors
38
*/
49

5-
.block {
6-
background: blue;
7-
color: white;
8-
width: 300px;
9-
margin: 2rem auto;
10-
/* margin-left: auto; */
11-
/* margin-right: auto; */
10+
* {
11+
margin: 0;
12+
padding: 0;
13+
box-sizing: border-box;
1214
}
1315

14-
.inline {
15-
background: red;
16-
color: white;
16+
body {
17+
font-family: Verdana, Geneva, Tahoma, sans-serif;
1718
}
1819

19-
body {
20-
text-align: center;
20+
ul li {
21+
list-style-type: none;
22+
}
23+
24+
ul li a {
25+
text-decoration: none;
26+
color: red;
27+
background: black;
28+
letter-spacing: 2px;
29+
display: block;
30+
padding: 5px;
31+
/* margin: 10px; */
2132
}

0 commit comments

Comments
 (0)