Styling
Styling the
WebKit and Firefox (appearance Property)
As of Firefox 35, both WebKit and Firefox browsers allow the use of the appearance property to remove the default styling of a
select { -webkit-appearance: none; -moz-appearance: none; appearance: none; }
IE 11 (::-ms-expand)
For IE 11 compatibility, you can use the ::-ms-expand pseudo-element to hide the default dropdown button.
select::-ms-expand { display: none; }
Old Solution (Using JavaScript)
Prior to the introduction of the appearance property, there was no way to style
One such JavaScript library is jQuery, which provides the selectmenu plugin:
$("select").selectmenu();
This plugin allows you to create custom dropdowns that can be styled using CSS.
Note:
It's important to note that using JavaScript to style
The above is the detailed content of How Can I Style Elements with CSS While Maintaining Cross-Browser Compatibility?. For more information, please follow other related articles on the PHP Chinese website!