I want make each first letter of select box capital but my code is work for only lowercase and uppercase. How to make capital starting letter of each word? Does capitalize work for crome browser or my code is wrong?
I try for more time but it work for only uppercase and lowercase not for capitalize
This my PHP code:
<select name="hotel_name1" id="hotel_name1" class="select-drop">
<option value disabled selected style="color:gray">Select Hotel</option>
<?php
while ($row=mysql_fetch_array($result)) {
?>
<option value="<?php echo $row["postid"]; ?>"><?php echo $row["hotel_name"]; ?></option>
<?php
}
?>
</select>
CSS:
select {
height: 1.4em; /* show only one option when not focused */
}
option {
text-transform: lowercase; /* change to lowercase */
padding-right: 2em; /* the select's width is based on width of its longest non-transformed ... */
/* option. padding ensures that option is completely visible */
display: none; /* hide all options by default (see below) */
}
option:first-letter {
text-transform: uppercase; /* change first letter to uppercase */
}
option:checked, select:focus option {
display: block; /* show selected option, or show all options when the select is focused */
}