Skip to content

Commit 9fbf512

Browse files
author
Adam Culpepper
committed
Adding in better disabled and read-only support
1 parent d324975 commit 9fbf512

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

float-labels.css

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
pure-css-float-labels v1.4
2+
pure-css-float-labels v1.5
33
by Adam Culpepper | @adamculpepper
44
https://github.com/adamculpepper/pure-css-float-labels
55
*/
@@ -24,21 +24,21 @@ https://github.com/adamculpepper/pure-css-float-labels
2424
user-select:none; /* Non-prefixed version, currently supported by Chrome, Opera and Firefox */
2525
}
2626
.has-float-label .form-control {padding-top:15px; padding-bottom:0;}
27-
.has-float-label .form-control:placeholder-shown:not(:focus) + label {
28-
opacity:0.50;
29-
top:50%;
30-
transform:translateY(-50%);
31-
font-size:1rem;
32-
color:inherit;
33-
}
27+
.has-float-label .form-control:placeholder-shown:not(:focus) + label {opacity:0.50; top:50%; transform:translateY(-50%); font-size:1rem; color:inherit;}
28+
29+
/* :disabled and :readonly styles */
30+
.has-float-label .form-control:read-only,
31+
.has-float-label .form-control:disabled,
32+
.has-float-label .form-control:disabled + label {opacity:0.5;}
3433

3534
/* Textarea elements*/
3635
.has-float-label textarea.form-control:placeholder-shown:not(:focus) + label {top:1.5rem;}
3736

3837
/* Select elements*/
3938
.has-float-label select.form-control {padding-left:0.50rem;}
4039
.has-float-label select.form-control:placeholder-shown:not(:focus) + label {top:1.5rem;}
41-
.has-float-label select.form-control option[value=""][disabled] {display:none;}
40+
.has-float-label select.form-control option[value=""]:read-only,
41+
.has-float-label select.form-control option[value=""]:disabled {display:none;}
4242

4343
/* Hide placeholders since we're taking care of those with label elements */
4444
.has-float-label ::-webkit-input-placeholder {color:transparent!important;}

0 commit comments

Comments
 (0)