如何将 span/label 文本显示到 select 标签中
How to show span/label text into select tag
我正在尝试在下拉列表的左侧显示文本“sesso”select。这就是我所做的,但它不起作用。我将 span 标签放在 select 标签内。
Fiddle: https://jsfiddle.net/snake93/7L168ws2/32/
input[type="text"]:not(.browser-default){
text-align: right;
margin-right: 10px;
}
.caret {
margin-left: 10px;
}
.select-wrapper input.select-dropdown {
padding-right: 15px!important;
}
<!-- Font Awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css">
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://motustrength.it/MDB4.19.1-PRO/css/bootstrap.min.css">
<!-- Material Design Bootstrap -->
<link rel="stylesheet" href="https://motustrength.it/MDB4.19.1-PRO/css/mdb.min.css">
<!-- Start your project here-->
<div class="prov">
<select class="mdb-select" id="inputGroupSelect03" >
<span class="input-group-tex">Sesso</span>
<option class="seleziona" selected value="0">Seleziona</option>
<option id="sexuomo" name="radios" value="Male" required class="sexbtn">Uomo</option>
<option id="sexdonna" name="radios" value="Female" form="bmrcalc" required class="sexbtn">Donna</option>
</select>
</div>
<!-- End your project here-->
<!-- jQuery -->
<script type="text/javascript" src="https://motustrength.it/MDB4.19.1-PRO/js/jquery.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="https://motustrength.it/MDB4.19.1-PRO/js/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="https://motustrength.it/MDB4.19.1-PRO/js/bootstrap.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="https://motustrength.it/MDB4.19.1-PRO/js/mdb.min.js"></script>
我不知道你是这个意思,但希望它能帮到你。
https://jsfiddle.net/GeorgeLXL/spLgbutv/1/
// Material Select Initialization
$(document).ready(function() {
$('.mdb-select').materialSelect();
});
input[type="text"]:not(.browser-default){
text-align: right;
margin-right: 10px;
}
.caret {
margin-left: 10px;
}
.select-wrapper input.select-dropdown {
padding-right: 15px!important;
}
.input-group-tex {
z-index: -1;
position: absolute;
top: 50%;
left: 15px;
transform: translateY(-50%);
}
.prov {
position: relative;
}
<!-- Font Awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css">
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://motustrength.it/MDB4.19.1-PRO/css/bootstrap.min.css">
<!-- Material Design Bootstrap -->
<link rel="stylesheet" href="https://motustrength.it/MDB4.19.1-PRO/css/mdb.min.css">
<!-- Start your project here-->
<div class="prov">
<span class="input-group-tex">Sesso</span>
<select class="mdb-select" id="inputGroupSelect03" >
<option class="seleziona" selected value="0">Seleziona</option>
<option id="sexuomo" name="radios" value="Male" required class="sexbtn">Uomo</option>
<option id="sexdonna" name="radios" value="Female" form="bmrcalc" required class="sexbtn">Donna</option>
</select>
</div>
<!-- End your project here-->
<!-- jQuery -->
<script type="text/javascript" src="https://motustrength.it/MDB4.19.1-PRO/js/jquery.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="https://motustrength.it/MDB4.19.1-PRO/js/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="https://motustrength.it/MDB4.19.1-PRO/js/bootstrap.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="https://motustrength.it/MDB4.19.1-PRO/js/mdb.min.js"></script>
我正在尝试在下拉列表的左侧显示文本“sesso”select。这就是我所做的,但它不起作用。我将 span 标签放在 select 标签内。
Fiddle: https://jsfiddle.net/snake93/7L168ws2/32/
input[type="text"]:not(.browser-default){
text-align: right;
margin-right: 10px;
}
.caret {
margin-left: 10px;
}
.select-wrapper input.select-dropdown {
padding-right: 15px!important;
}
<!-- Font Awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css">
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://motustrength.it/MDB4.19.1-PRO/css/bootstrap.min.css">
<!-- Material Design Bootstrap -->
<link rel="stylesheet" href="https://motustrength.it/MDB4.19.1-PRO/css/mdb.min.css">
<!-- Start your project here-->
<div class="prov">
<select class="mdb-select" id="inputGroupSelect03" >
<span class="input-group-tex">Sesso</span>
<option class="seleziona" selected value="0">Seleziona</option>
<option id="sexuomo" name="radios" value="Male" required class="sexbtn">Uomo</option>
<option id="sexdonna" name="radios" value="Female" form="bmrcalc" required class="sexbtn">Donna</option>
</select>
</div>
<!-- End your project here-->
<!-- jQuery -->
<script type="text/javascript" src="https://motustrength.it/MDB4.19.1-PRO/js/jquery.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="https://motustrength.it/MDB4.19.1-PRO/js/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="https://motustrength.it/MDB4.19.1-PRO/js/bootstrap.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="https://motustrength.it/MDB4.19.1-PRO/js/mdb.min.js"></script>
我不知道你是这个意思,但希望它能帮到你。
https://jsfiddle.net/GeorgeLXL/spLgbutv/1/
// Material Select Initialization
$(document).ready(function() {
$('.mdb-select').materialSelect();
});
input[type="text"]:not(.browser-default){
text-align: right;
margin-right: 10px;
}
.caret {
margin-left: 10px;
}
.select-wrapper input.select-dropdown {
padding-right: 15px!important;
}
.input-group-tex {
z-index: -1;
position: absolute;
top: 50%;
left: 15px;
transform: translateY(-50%);
}
.prov {
position: relative;
}
<!-- Font Awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css">
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://motustrength.it/MDB4.19.1-PRO/css/bootstrap.min.css">
<!-- Material Design Bootstrap -->
<link rel="stylesheet" href="https://motustrength.it/MDB4.19.1-PRO/css/mdb.min.css">
<!-- Start your project here-->
<div class="prov">
<span class="input-group-tex">Sesso</span>
<select class="mdb-select" id="inputGroupSelect03" >
<option class="seleziona" selected value="0">Seleziona</option>
<option id="sexuomo" name="radios" value="Male" required class="sexbtn">Uomo</option>
<option id="sexdonna" name="radios" value="Female" form="bmrcalc" required class="sexbtn">Donna</option>
</select>
</div>
<!-- End your project here-->
<!-- jQuery -->
<script type="text/javascript" src="https://motustrength.it/MDB4.19.1-PRO/js/jquery.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="https://motustrength.it/MDB4.19.1-PRO/js/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="https://motustrength.it/MDB4.19.1-PRO/js/bootstrap.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="https://motustrength.it/MDB4.19.1-PRO/js/mdb.min.js"></script>