Skip to content

Commit 6b7b57f

Browse files
committed
Custom Range Input ⛰️
1 parent 5a997cd commit 6b7b57f

File tree

6 files changed

+109
-0
lines changed

6 files changed

+109
-0
lines changed
74.3 KB
Loading

20-custom-range-input/images/Edge.png

218 KB
Loading
75.8 KB
Loading
72.7 KB
Loading

20-custom-range-input/index.html

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>
7+
CSS - Custom Range Input That Looks Consistent Across All Browsers
8+
</title>
9+
<link rel="stylesheet" href="style.css" />
10+
</head>
11+
<body>
12+
<header>
13+
<h2>Custom Range Input That Looks Consistent Across All Browsers!</h2>
14+
</header>
15+
<main class="container">
16+
<h3>Browser Inconsistencies</h3>
17+
<div class="images">
18+
<div class="image">
19+
<figure>
20+
<img src="images/Chrome.png" alt="Chrome" />
21+
<figcaption>Chrome</figcaption>
22+
</figure>
23+
</div>
24+
<div class="image">
25+
<figure>
26+
<img src="images/Firefox.png" alt="Firefox" />
27+
<figcaption>Firefox</figcaption>
28+
</figure>
29+
</div>
30+
<div class="image">
31+
<figure>
32+
<img src="images/Safari.png" alt="Safari" />
33+
<figcaption>Safari</figcaption>
34+
</figure>
35+
</div>
36+
<div class="image">
37+
<figure>
38+
<img src="images/Edge.png" alt="Edge" />
39+
<figcaption>Edge</figcaption>
40+
</figure>
41+
</div>
42+
</div>
43+
</main>
44+
<section>
45+
<h3>Custom range input</h3>
46+
<input type="range" name="custom-range" id="custom-range" />
47+
</section>
48+
</body>
49+
</html>

20-custom-range-input/style.css

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
@import url("https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400..700;1,400..700&display=swap");
2+
3+
*,
4+
::before,
5+
::after {
6+
margin: 0;
7+
padding: 0;
8+
box-sizing: border-box;
9+
font-family: "Lora", serif;
10+
}
11+
12+
body {
13+
display: flex;
14+
flex-direction: column;
15+
align-items: center;
16+
}
17+
18+
header {
19+
margin: 20px 0;
20+
}
21+
22+
img {
23+
width: 200;
24+
height: 200px;
25+
}
26+
27+
.images {
28+
display: grid;
29+
grid-template-columns: repeat(2, 1fr);
30+
gap: 20px;
31+
}
32+
33+
h3 {
34+
text-align: center;
35+
margin-bottom: 20px;
36+
}
37+
38+
figcaption {
39+
text-align: center;
40+
}
41+
42+
input[type="range"] {
43+
-webkit-appearance: none;
44+
appearance: none; /* By giving it the value of none this tells each respective browser to clear out any default styles.
45+
This removes track: this is the part of the horizontal slider that the circular thumb runs along */
46+
background: transparent;
47+
cursor: pointer;
48+
width: 15rem;
49+
background: #053a5f;
50+
height: 0.5rem;
51+
}
52+
53+
input[type="range"]::-webkit-slider-thumb {
54+
appearance: none;
55+
}
56+
57+
input[type="range"]::-moz-range-thumb {
58+
-moz-appearance: none;
59+
appearance: none;
60+
}

0 commit comments

Comments
 (0)