Skip to content

Commit 5f77ba0

Browse files
committed
Background Images - Linear Gradients
1 parent 512ccb1 commit 5f77ba0

File tree

2 files changed

+47
-4
lines changed

2 files changed

+47
-4
lines changed

index.html

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

1313
<body>
14-
<div class="big-img">
14+
<!-- <div class="big-img">
1515
<h1>I'm big image</h1>
1616
</div>
1717
<div class="small-img">
1818
<h1>I'm small image</h1>
1919
</div>
2020
<div class="folder-img">
2121
<h1>I'm folder image</h1>
22-
</div>
22+
</div> -->
23+
24+
<div class="one"></div>
25+
<div class="two"></div>
26+
<div class="three"></div>
27+
<div class="four"></div>
28+
<div class="five"></div>
29+
<div class="six"></div>
2330
</body>
2431
</html>

styles.css

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,42 @@
1-
/* background-attachment */
1+
/* Linear Gradients */
22

33
* {
4+
width: 150px;
5+
height: 200px;
6+
margin: 5px;
7+
}
8+
9+
/* by default direction is to bottom */
10+
.one {
11+
background: linear-gradient(red, blue);
12+
}
13+
14+
/* changing direction by text and multiple various values */
15+
.two {
16+
background: linear-gradient(to top, red, blue, green, yellow, #f15602);
17+
}
18+
19+
/* changing direction by degrees, default is 180 */
20+
.three {
21+
background: linear-gradient(315deg, red, blue);
22+
}
23+
24+
/* applying direction with go to top of right side */
25+
.four {
26+
background: linear-gradient(to top right, red, yellow);
27+
}
28+
29+
/* control from where to start */
30+
.five {
31+
background: linear-gradient(red 20%, blue 50%);
32+
}
33+
34+
/* using fading with rgba */
35+
.six {
36+
background: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 1));
37+
}
38+
39+
/* * {
440
margin: 0;
541
padding: 0;
642
box-sizing: border-box;
@@ -39,4 +75,4 @@ div {
3975
background-size: cover;
4076
background-position: center;
4177
background-attachment: fixed;
42-
}
78+
} */

0 commit comments

Comments
 (0)