File tree Expand file tree Collapse file tree 2 files changed +22
-41
lines changed Expand file tree Collapse file tree 2 files changed +22
-41
lines changed Original file line number Diff line number Diff line change 11
11
</ head >
12
12
13
13
< body >
14
- < div >
15
- < img src ="./big.jpeg " alt ="big-retro " />
14
+ < div class ="box "> regular box</ div >
15
+ < div class ="box special ">
16
+ < h1 > special</ h1 >
16
17
</ div >
17
18
</ body >
18
19
</ html >
Original file line number Diff line number Diff line change 1
- /*
2
- ::before ::after pseudo-elements creates element and inserts before and after CONTENT
3
- content:'' - required
4
- img --- does not work
1
+ /* The inset CSS property is a shorthand
2
+ that corresponds to the top, right, bottom,left properties.
5
3
*/
6
4
7
- div {
8
- width : 70vw ;
9
- /* border: 3px solid red; */
10
- margin : 100px auto;
11
- position : relative;
5
+ * {
6
+ margin : 0 ;
12
7
}
13
8
14
- img {
15
- width : 100% ;
16
- display : block;
9
+ .box {
10
+ background : orange;
11
+ width : 300px ;
12
+ height : 300px ;
13
+ margin-bottom : 1rem ;
17
14
}
18
15
19
- div ::before {
20
- content : "" ;
21
- border : 2px solid grey;
22
- box-sizing : border-box;
23
- width : 100% ;
24
- height : 100% ;
25
- position : absolute;
26
- top : -40px ;
27
- left : -40px ;
28
- z-index : -2 ;
29
- transition : all 0.5s linear;
16
+ .special {
17
+ position : relative;
30
18
}
31
19
32
- div ::after {
33
- content : "" ;
34
- background : rgba (128 , 128 , 128 , 0.5 );
35
- /* background: grey; */
36
- box-sizing : border-box;
37
- width : 100% ;
38
- height : 100% ;
20
+ .special h1 {
21
+ background : rgba (0 , 0 , 0 , 0.5 );
39
22
position : absolute;
40
- top : -20px ;
41
- left : -20px ;
42
- z-index : -1 ;
43
- transition : all 0.5s linear;
44
- }
45
-
46
- div : hover ::before ,
47
- div : hover ::after {
48
- top : 0 ;
23
+ /* top: 0;
49
24
left: 0;
25
+ bottom: 0;
26
+ right: 0; */
27
+ inset : 0 ;
28
+ text-align : center;
29
+ color : white;
50
30
}
You can’t perform that action at this time.
0 commit comments