Last active
July 10, 2019 10:28
-
-
Save jerinisready/7b9ec859f194eb7af5c22bfa932003bc to your computer and use it in GitHub Desktop.
This is how to create MDB Select2 With your own css.. I have used Danger theme.. I wish to make it avail for all other colour codes in mdb!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<meta http-equiv="x-ua-compatible" content="ie=edge"> | |
<title>Material Design Select2 Bootstrap</title> | |
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/css/select2.min.css" rel="stylesheet" /> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/js/select2.min.js"></script> | |
<style> | |
.mdb-select2 {width: 100%;} | |
.select2-container {margin-top: 1em;} | |
.bmd-form-group .form-control, .bmd-form-group label, .bmd-form-group input::placeholder{line-height:1} | |
span.select2.select2-container.select2-container--default{width: 100%!important;} | |
.select2-container--default .select2-selection--single {border-top: 0;border-left: 0;border-right: 0;border-bottom: 1px solid #ccc;background-color: transparent;border-radius: 0;} | |
.select2-dropdown, .select2-dropdown--above {border-radius: 0;padding: 0.35rem;border: 0;box-shadow: 0 2px 5px 0 rgba(0, 0, 0, .16), 0 2px 10px 0 rgba(0, 0, 0, .12);} | |
.select2-container--default .select2-selection--multiple {border-top: 0;border-left: 0;border-right: 0;border-bottom: 1px solid #ccc;background-color: transparent;border-radius: 0;height: 40px;} | |
.select2-container *:focus {outline: none;} | |
.select2-container--default.select2-container--focus .select2-selection--multiple {border: 0;} | |
.select2-container--default .select2-selection--multiple .select2-selection__choice {background-color: #fff;} | |
.select2-selection__choice__remove {color: #381fa8!important;} | |
.select2-results__option {color: #000000dd;font-size: small;} | |
.select2-results__option--highlighted,.select2-results__option[aria-selected="true"] {color: #fff;border-radius:.25rem} | |
.select2-container--default .select2-results__option--highlighted[aria-selected] {box-shadow:0 4px 20px 0px rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(244, 67, 54, 0.4); background-color: #f33527;color: #fff;} | |
.select2-container--default .select2-results__option[aria-selected="true"] {box-shadow:0 4px 20px 0px rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(244, 67, 54, 0.4); background-color: #f33527;color: #fff;} | |
</style> | |
<div class="mdb-select2"> | |
</select> | |
<script type="text/javascript"> | |
$('document').ready(function() { | |
$('.mdb-select2').select2(); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment