Skip to content

Commit ed4809d

Browse files
committed
Positions, Float, Media Queries - position: fixed
1 parent 4e7e3f6 commit ed4809d

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
</head>
1212

1313
<body>
14+
<div class="navbar">navbar</div>
1415
<div>
1516
<p class="first">
1617
Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatum

styles.css

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ postion:fixed - relative to viewport(screen),stays as we are scrolling
44
will use other content to fill out the space
55
*/
66

7+
.navbar {
8+
background: red;
9+
color: white;
10+
font-size: 1.5rem;
11+
text-transform: capitalize;
12+
position: fixed;
13+
margin: 0;
14+
top: 0;
15+
left: 0;
16+
width: 100%;
17+
}
18+
719
div {
820
border: 5px solid red;
921
background: yellow;
@@ -18,16 +30,12 @@ div {
1830
.second {
1931
background: green;
2032
color: white;
21-
position: relative;
2233
}
2334

2435
.special {
2536
background: fuchsia;
2637
color: black;
2738
font-size: 20px;
28-
position: absolute;
29-
top: 0;
30-
left: 0;
3139
}
3240

3341
.container {

0 commit comments

Comments
 (0)