Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select dropdown inline label text

I want to insert a label inside my select dropdown.

Here, Sell in is the label text and United States is one of the dropdown options. What's the best way to implement this.I feel i'll have to write a custom dropdown.

like image 449
Ayush Goel Avatar asked Apr 21 '26 20:04

Ayush Goel


2 Answers

Did you mean something like this? http://jsfiddle.net/rw6d2r25/6/

select {
    padding-left:65px;
    height:40px;
    position:relative;
    border:1px solid #333;
    width:300px;
    display:block;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    -o-appearance: none;
    -ms-appearance: none;
    border-radius: 0;
    -webkit-box-shadow: none;
}
label {
    position:absolute;
    z-index:1;
    height:40px;
    line-height:40px;
    pointer-events:none;
    text-indent:10px;
    font-weight:bold;
}
label, select {
    font-family:Arial;
    font-size:15px;
}
<label>Sell In:</label>
<select>
    <option>United States</option>
    <option>United AE</option>
</select>
like image 68
gopalraju Avatar answered Apr 24 '26 10:04

gopalraju


Make the <select> naked:

* {font-family: 'Segoe UI'; font-size: 10pt;}
select {border: none; color: #666;}
<label>
  <span>Sell in</span>
  <select>
    <option>United States</option>
  </select>
</label>
like image 20
Praveen Kumar Purushothaman Avatar answered Apr 24 '26 11:04

Praveen Kumar Purushothaman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!