Author -  Sai gowtham

Styling select element box in CSS

In this tutorial, we are going to learn about how to style a <select> element box in CSS.

By default select element styling varies from browser to browser, so that we can create our own custom styling to look the same in all browsers.

This example shows you how to style a select dropdown with your own styling.

<select>
    <option>Apples</option>
    <option selected>Pineapples</option>
    <option>Chocolate</option>
    <option>Pancakes</option>
</select>
select {
  margin: 50px;
  width: 550px;
  font-size:17px;
  padding: 10px 35px 10px 10px;
  font-size: 16px;
  border: 1px solid #ccc;
  height: 54px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: url(http://tuckeralbin.com/wp-content/uploads/intense-cache/icons/plugin/font-awesome/angle-double-down.svg);
  background-repeat:no-repeat;
  background-size: 5%;
  background-position: 98% 50%;
}

select::-ms-expand {
    display: none; /* remove default arrow on ie10 and ie11 */
}

In this above example, we are using appearance:none css property to hide the select element arrow then we added our own arrow using background css property.

background-size property is used to set the size of a dropdown arrow.

background-position property is used to position the arrow in the x-axis and y-axis.

Demo 1

Demo 2

In this demo, we have changed background-color and font-family to the select element.

Css Tutorials & Demos

How rotate an image continuously in CSS

In this demo, we are going to learn about how to rotate an image continuously using the css animations.

How to create a Instagram login Page

In this demo, i will show you how to create a instagram login page using html and css.

How to create a pulse animation in CSS

In this demo, i will show you how to create a pulse animation using css.

Creating a snowfall animation using css and JavaScript

In this demo, i will show you how to create a snow fall animation using css and JavaScript.

Top Udemy Courses

JavaScript - The Complete Guide 2023 (Beginner + Advanced)
JavaScript - The Complete Guide 2023 (Beginner + Advanced)
116,648 students enrolled
52 hours of video content
$14.99 FROM UDEMY
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
631,582 students enrolled
49 hours of video content
$24.99 FROM UDEMY
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
203,937 students enrolled
31.5 hours of video content
$14.99 FROM UDEMY