Skip to content

Commit edddc0e

Browse files
committed
d
1 parent 61925d3 commit edddc0e

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

pages/html/float-label-pattern/floating-label-pattern.css

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
--floating-label-text: #3c4043;
66
--floating-label-label: #5f6368;
77
--floating-label-bg: #ffffff;
8+
--floating-label-font-size: 16px;
89
--transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
910
}
1011

@@ -14,15 +15,15 @@
1415
}
1516
.floating-label {
1617
min-height: 58px;
18+
margin-bottom: 12px;
1719
}
1820
/* things you might want to change ^^^^^ */
1921

2022
.floating-label {
2123
position: relative;
22-
display: grid;
23-
grid-template-rows: var(--floating-label-height, 34px) auto;
24-
gap: 0;
25-
margin-bottom: 12px;
24+
/* display: grid; */
25+
/* grid-template-rows: var(--floating-label-height, 34px) auto; */
26+
/* gap: 0; */
2627
}
2728
/* The visual border box */
2829
.floating-label::after {
@@ -46,14 +47,14 @@
4647

4748
.floating-label input {
4849
grid-row: 1;
49-
width: 100%;
50+
/* width: 100%; */
5051
height: var(--floating-label-height, 34px);
5152
border: none;
5253
background: transparent;
5354
padding: 0 12px;
54-
font-size: 16px;
55-
color: var(--floating-label-text);
56-
outline: none;
55+
font-size: var(--floating-label-font-size);
56+
/* color: var(--floating-label-text); */
57+
/* outline: none; */
5758
box-sizing: border-box;
5859
z-index: 2;
5960
position: relative;
@@ -75,7 +76,7 @@
7576
left: 7px;
7677
top: 17px; /* 50% of 34px */
7778
transform: translateY(-50%);
78-
font-size: 16px;
79+
font-size: var(--floating-label-font-size);
7980
color: var(--floating-label-label);
8081
pointer-events: none;
8182
transition: all var(--transition);
@@ -102,7 +103,7 @@
102103
box-shadow: 0 0 0 2px var(--floating-label-error);
103104
}
104105

105-
.floating-label[data-error] input:is(:not(:placeholder-shown), :focus) + label {
106+
.floating-label[data-error] input + label {
106107
color: var(--floating-label-error);
107108
}
108109

@@ -118,8 +119,8 @@
118119
visibility: hidden;
119120
opacity: 0;
120121
transition: opacity var(--transition);
121-
line-height: 16px;
122-
height: 16px; /* Fixed height for reservation */
122+
line-height: var(--floating-label-font-size);
123+
height: var(--floating-label-font-size); /* Fixed height for reservation */
123124
z-index: 1;
124125
}
125126

0 commit comments

Comments
 (0)