-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay21_ExpandingSearchBar.css
74 lines (61 loc) · 1.35 KB
/
Day21_ExpandingSearchBar.css
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
/*<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Title Here</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<div class="container">
<label for="search-field" class="visually-hidden">Search:</label>
<input type="search"
class="search-bar"
id="search-field"
placeholder="Search..."
/>
</div>
</body>
</html>*/
html, body {
margin: 0;
padding: 0;
}
:root {
--search-border: #bbb;
--search-focus-border: #3a71ca;
}
.container {
/* background: yellow; */
display: flex;
margin-left: 50px;
margin-top: 50px;
width: 300px;
height: 50px;
}
.search-bar {
border: solid #d4d4d4;
border-radius: 10px;
border-width: 2px;
padding: 10px;
width: 180px;
height: 50px;
transition: width 1s ease-in-out;
}
.search-bar:focus {
width: 300px;
}
.search-bar:focus::placeholder {
color: transparent;
}
/* visually hide the label, but keep it accessible to screen readers */
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}