I have implemented the Bootstrap Float-label feature found at https://github.com/tonystar/float-label-css
Note: I made some custom changes to suit my needs.
Issues :
1) While clicking on an input, the float label functions correctly. However, the bootstrap form input border is visible within the float label background.
https://i.sstatic.net/701zK.jpg
2) Upon validation, the float label for the next input gets disrupted, causing it to overlap with the input field. I placed the error message
<span id="error_*****" class="error"></span>
outside <span class="has-float-label">
https://i.sstatic.net/NQbJU.jpg
3) Differences in appearance across various browsers are noted below. In IE and Edge, float labels apply by default. Is this acceptable or are there any specific solutions for IE and Edge?
https://i.sstatic.net/8lwDR.jpg
Additional Information relevant to my scenario:
Operating System: Windows 10 64-bit
Browsers Tested: Firefox (Version 72.0.1), Chrome (Version 79.0.3945.117), Opera (Version 65.0.3467.78), MS-Edge (Version 44.18362.449.0), MS-IE (Version 11.535.18362.0)
Bootstrap Version Utilized: 4.4.1
// JavaScript function
function trim(stringToTrim) {
return stringToTrim.replace(/^\s+|\s+$/g,"");
}
$(document).ready(function() {
$("#btn_contactus").click(function() {
// Validation script here
});
});
// CSS styles for float labels
.instruction {
// Instructions styling
}
.required {
// Required fields styling
}
.error {
// Error messages styling
}
.has-float-label{
// Float label container
}
...
.insert remaining CSS code snippets...
// External libraries and resources
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
...
.insert remaining HTML and CSS code snippets...