Skip to content

Commit ad6b44c

Browse files
committed
Positions, Float, Media Queries - ::before and ::after Basics
1 parent c5d2f46 commit ad6b44c

File tree

2 files changed

+20
-40
lines changed

2 files changed

+20
-40
lines changed

index.html

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

1313
<body>
14-
<div class="banner">
15-
<img src="./small.jpeg" alt="small retro" class="first-image" />
16-
<img src="./big.jpeg" alt="big retro" class="second-image" />
17-
<img
18-
src="./images/folder-img.jpeg"
19-
alt="folder retro"
20-
class="third-image"
21-
/>
22-
</div>
14+
<p>I'm extremely simple</p>
2315
</body>
2416
</html>

styles.css

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,25 @@
11
/*
2-
z-index --- z-axis
3-
0 - default
4-
does not work on position:static;
2+
::before ::after pseudo-elements creates element and inserts before and after CONTENT
3+
content:'' - required
4+
img --- does not work
55
*/
66

7-
img {
8-
width: 250px;
9-
height: 250px;
10-
position: absolute;
7+
p::before {
8+
content: "hello world";
9+
font-size: 2rem;
10+
color: blue;
11+
font-weight: 700;
12+
display: block;
13+
background: yellow;
1114
}
1215

13-
.banner {
14-
position: relative;
15-
border: 5px solid red;
16-
width: 80vw;
17-
height: 75vh;
18-
margin: 50px auto;
19-
}
20-
21-
.first-image {
22-
top: 0;
23-
left: 0;
24-
z-index: 3;
25-
}
26-
27-
.second-image {
28-
top: 10%;
29-
left: 10%;
30-
z-index: 2;
31-
}
32-
33-
.third-image {
34-
top: 20%;
35-
left: 20%;
36-
z-index: -1;
16+
p::after {
17+
content: "";
18+
font-size: 1rem;
19+
color: red;
20+
font-weight: 700;
21+
background: greenyellow;
22+
display: block;
23+
width: 100%;
24+
height: 3rem;
3725
}

0 commit comments

Comments
 (0)