Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd886d02

Browse files
committed
Added Project 24 - Custom Checkbox
1 parent6328d1a commitd886d02

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

‎24- Custom Checkbox/index.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<htmllang="en">
3+
<head>
4+
<metacharset="UTF-8"/>
5+
<metahttp-equiv="X-UA-Compatible"content="IE=edge"/>
6+
<metaname="viewport"content="width=device-width, initial-scale=1.0"/>
7+
<linkrel="stylesheet"href="style.css"/>
8+
<title>Custom Checkbox</title>
9+
</head>
10+
<body>
11+
<div>
12+
<divclass="checkbox checkbox-1">
13+
<inputtype="checkbox"id="checkbox-1"/>
14+
<labelfor="checkbox-1">Checkbox 1</label>
15+
</div>
16+
<divclass="checkbox checkbox-2">
17+
<inputtype="checkbox"id="checkbox-2"/>
18+
<labelfor="checkbox-2">Checkbox 2</label>
19+
</div>
20+
</div>
21+
</body>
22+
</html>

‎24- Custom Checkbox/style.css

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
body {
2+
margin:0;
3+
display: grid;
4+
place-items: center;
5+
min-height:100vh;
6+
}
7+
8+
.checkboxinput {
9+
display: none;
10+
}
11+
12+
label {
13+
font-family: -apple-system, BlinkMacSystemFont,"Segoe UI", Roboto, Oxygen,
14+
Ubuntu, Cantarell,"Open Sans","Helvetica Neue", sans-serif;
15+
font-size:1.5rem;
16+
position: relative;
17+
user-select: none;
18+
}
19+
20+
.checkboxlabel:before {
21+
content:"";
22+
display: inline-block;
23+
width:20px;
24+
height:20px;
25+
border:1px solid#4caf50;
26+
margin-right:0.5rem;
27+
border-radius:2px;
28+
transition: all0.3s;
29+
}
30+
31+
.checkbox-1label:after {
32+
content:"";
33+
position: absolute;
34+
left:8px;
35+
top:8px;
36+
display: inline-block;
37+
width:4px;
38+
height:10px;
39+
border: solid#fff;
40+
border-width:03px3px0;
41+
transform:rotate(45deg)scale(0);
42+
transition: transform0.3s;
43+
}
44+
45+
.checkbox-1input:checked+label:before,
46+
.checkbox-2input:checked+label:before {
47+
background-color:#4caf50;
48+
}
49+
50+
.checkbox-1input:checked+label:after {
51+
transform:rotate(45deg)scale(1);
52+
}
53+
54+
.checkbox-2label:after {
55+
content:"\2713";
56+
position: absolute;
57+
left:1px;
58+
top:-2px;
59+
transform:rotate(10deg)scale(0);
60+
color:#fff;
61+
transition: transform0.3s;
62+
}
63+
64+
.checkbox-2input:checked+label:after {
65+
transform:rotate(10deg)scale(0.9);
66+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp