Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to style a select box only on mobile devices

Tags:

html

css

Actually I am trying to style <select> box using CSS(no any image as background) my problem is when I view it on mobile devices it show me like a textbox please guide me how to make it like a select box with css. Note: I don't want any background image in css.

select {
    background: -webkit-linear-gradient(white, #666);
    border: 1px solid #ccc;
    border-radius: 5px;
    color: white;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
    -webkit-appearance: none;
}
like image 938
Developer_world Avatar asked Apr 17 '15 19:04

Developer_world


People also ask

Can I style select options?

You can style select > option , but there are no reliable crossbrowser solution for doing so and, on chrome at least you can at most customize font size, family, background and foreground color.

Can you style a select element?

Styling the button part We can apply CSS properties to the <select> element and change its background color, borders, font, size, margin, padding, and more.

Can you style select dropdown?

Box drop-down stylingThere are several elements of a select box that can be styled, particularly the height, width, font, border, color, padding, box-shadow and background color.

Can you style HTML select?

<select> tags can be styled through CSS just like any other HTML element on an HTML page rendered in a browser. Below is an (overly simple) example that will position a select element on the page and render the text of the options in blue.


1 Answers

You can do it using max-device-width (CSS3):

@media only screen and (max-device-width: 480px) {
select {
    background: -webkit-linear-gradient(white, #666);
    border: 1px solid #ccc;
    border-radius: 5px;
    color: white;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
    -webkit-appearance: none;
}
}
like image 79
gutenburgb Avatar answered Oct 03 '22 09:10

gutenburgb