I am trying to figure out how to get this code to work in IE and Edge. It works perfectly in Chrome and Firefox and looks good too. I understand that it may deal with browser support for :placeholder-shown but I am not sure and can't figure it out. Obviously if you run it in Edge the labels don't float up and when you type it just appears on top of the label. Here is the code I am using if anyone can help:
Here is the original source: https://jsfiddle.net/7z8q4pyd/
CSS
:root {
--input-padding-x: .75rem;
--input-padding-y: .75rem;
}
.form-signin {
width: 100%;
padding: 15px;
margin: 0 auto;
}
.form-label-group {
position: relative;
margin-bottom: 1rem;
}
.form-label-group > input,
.form-label-group > label {
padding: var(--input-padding-y) var(--input-padding-x);
}
.form-signin select{
display: block;
width: 100%;
padding: .375rem .75rem;
font-size: 1rem;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ced4da;
border-radius: .25rem;
}
.form-label-group > label {
position: absolute;
top: 0;
left: 0;
display: block;
width: 100%;
margin-bottom: 0; /* Override default `<label>` margin */
line-height: 1.5;
color: #495057;
border: 1px solid transparent;
border-radius: .25rem;
transition: all .1s ease-in-out;
}
.form-label-group input::-webkit-input-placeholder {
color: transparent;
}
.form-label-group input:-ms-input-placeholder {
color: transparent;
}
.form-label-group input::-ms-input-placeholder {
color: transparent;
}
.form-label-group input::-moz-placeholder {
color: transparent;
}
.form-label-group input::placeholder {
color: transparent;
}
.form-label-group input:not(:placeholder-shown) {
padding-top: calc(var(--input-padding-y) + var(--input-padding-y) * (2 / 3));
padding-bottom: calc(var(--input-padding-y) / 3);
}
.form-label-group input:not(:placeholder-shown) ~ label {
padding-top: calc(var(--input-padding-y) / 3);
padding-bottom: calc(var(--input-padding-y) / 3);
font-size: 12px;
color: #777;
}
HTML
<form class="form-signin" action="" method="post">
<div class="row">
<div class="col-xs-12 col-md-6">
<div class="form-label-group">
<input type="text" name="fullname" id="inputName" class="form-control" placeholder="Full Name" required >
<label for="inputName">Full Name</label>
</div>
</div>
</div>
....
</form>