-
Notifications
You must be signed in to change notification settings - Fork 287
/
focus.html
142 lines (124 loc) · 4.42 KB
/
focus.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">
<title>Рейтинг: Фокусный</title>
<style>
body {
margin: 0;
padding: 25px;
font-family: sans-serif;
}
/* Rating */
.rating {
margin: 0 0 1em 0;
padding: 0;
border: none;
}
/* Caption */
.rating__caption {
margin-bottom: 0.5em;
padding: 0;
}
/* Group */
.rating__group {
position: relative;
width: 10em;
height: 2em;
background-image: url(images/off.svg);
background-size: 2em auto;
background-repeat: repeat-x;
}
/* Star */
.rating__star {
position: absolute;
top: 0;
left: 0;
margin: 0;
height: 2em;
font-size: inherit;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background-size: 2em auto;
background-repeat: repeat-x;
}
.rating__star:focus {
outline: none;
}
.rating__star:focus ~ .rating__focus {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -1;
outline: 0.2em solid #4a90e2;
outline-offset: 0.2em;
}
.rating__star:hover,
.rating__star:checked {
background-image: url(images/on.svg);
}
.rating__star:hover ~ .rating__star {
background-image: url(images/off.svg);
}
/* Options */
.rating__star:nth-of-type(1) {
z-index: 5;
width: 2em;
}
.rating__star:nth-of-type(2) {
z-index: 4;
width: 4em;
}
.rating__star:nth-of-type(3) {
z-index: 3;
width: 6em;
}
.rating__star:nth-of-type(4) {
z-index: 2;
width: 8em;
}
.rating__star:nth-of-type(5) {
z-index: 1;
width: 10em;
}
</style>
</head>
<body>
<fieldset class="rating">
<legend class="rating__caption">Самочувствие</legend>
<div class="rating__group">
<input class="rating__star" type="radio" name="health" value="1" aria-label="Ужасно" checked>
<input class="rating__star" type="radio" name="health" value="2" aria-label="Сносно">
<input class="rating__star" type="radio" name="health" value="3" aria-label="Нормально">
<input class="rating__star" type="radio" name="health" value="4" aria-label="Хорошо">
<input class="rating__star" type="radio" name="health" value="5" aria-label="Отлично">
<div class="rating__focus"></div>
</div>
</fieldset>
<fieldset class="rating">
<legend class="rating__caption">Настроение</legend>
<div class="rating__group">
<input class="rating__star" type="radio" name="mood" value="1" aria-label="Ужасно">
<input class="rating__star" type="radio" name="mood" value="2" aria-label="Сносно">
<input class="rating__star" type="radio" name="mood" value="3" aria-label="Нормально" checked>
<input class="rating__star" type="radio" name="mood" value="4" aria-label="Хорошо">
<input class="rating__star" type="radio" name="mood" value="5" aria-label="Отлично">
<div class="rating__focus"></div>
</div>
</fieldset>
<fieldset class="rating">
<legend class="rating__caption">Вообще</legend>
<div class="rating__group">
<input class="rating__star" type="radio" name="general" value="1" aria-label="Ужасно">
<input class="rating__star" type="radio" name="general" value="2" aria-label="Сносно">
<input class="rating__star" type="radio" name="general" value="3" aria-label="Нормально">
<input class="rating__star" type="radio" name="general" value="4" aria-label="Хорошо">
<input class="rating__star" type="radio" name="general" value="5" aria-label="Отлично" checked>
<div class="rating__focus"></div>
</div>
</fieldset>
</body>
</html>