1

I found a nice style for my input elements but now I want to create a style that will look similar (or complementary) for my select elements.

I would like someone familiar with CSS styles to give me a class style I can use for my select elements.

Input Element Class:

input {
    background: 12px 11px no-repeat, -moz-linear-gradient(top, #f7f7f8 0%, #ffffff 100%);
    background: 12px 11px no-repeat, -webkit-linear-gradient(top, #f7f7f8 0%, #ffffff 100%);
    background: 12px 11px no-repeat, -o-linear-gradient(top, #f7f7f8 0%, #ffffff 100%);
    background: 12px 11px no-repeat, -ms-linear-gradient(top, #f7f7f8 0%, #ffffff 100%);
    margin: 5px 10px 5px 10px;
    background: 12px 11px no-repeat, linear-gradient(to bottom, #f7f7f8 0%, #ffffff 100%);
    border-radius: 3px;
    border: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) inset, 0 -1px 0 rgba(0, 0, 0, 0.05) inset;
    -webkit-transition: all 0.2s linear;
    -moz-transition: all 0.2s linear;
    -ms-transition: all 0.2s linear;
    -o-transition: all 0.2s linear;
    transition: all 0.2s linear;
    font-family: "Helvetica Neue", sans-serif;
    font-size: 13px;
    color: #222222;
    position: relative;
    height: 36px;
    width: 300px;
    padding-left: 10px;
}
input::-webkit-input-placeholder {
    color: #999999;
}
input:-moz-placeholder {
    color: #999999;
}
input:focus {
    box-shadow: 0 1px 0 #2392f3 inset, 0 -1px 0 #2392f3 inset, 1px 0 0 #2392f3 inset,     -1px 0 0 #2392f3 inset, 0 0 4px rgba(35, 146, 243, 0.5);
    outline: none;
    background: 12px 11px no-repeat, #ffffff;
}
MaVRoSCy
  • 17,401
  • 14
  • 78
  • 121
fred1234
  • 299
  • 3
  • 26

1 Answers1

2

If you wanted a similar style to your inputs I'd suggest copying the code and applying it for select elements too. Of course you can modify the code to fit your needs, heres a basic example of what you could do:

DEMO

You just change:

input{}

..to..

select{}

Which applies the CSS too all html select elements.

Styling select inputs isn't always as straight foward as styling a text input, for examples I suggest you read through this post.


EDIT:

After doing some research, I found that it is almost impossible to style select options because they are rendered by the OS and not the browser.

This is the closest I could make the select match your input:

DEMO

This is using jQuery which is what I would initially suggest. I would also highly suggest checking out some jQuery plugins which can handle styling of the select inputs.

For example, I found this one:

http://gregfranko.com/jquery.selectBoxIt.js/#.UXpaF7XvuCk

Which looks like it would work nicely with the style you're using.

Community
  • 1
  • 1
chriz
  • 1,560
  • 19
  • 27
  • Thank You. I actually tried that but figured it didn't work since I couldn't see gradient on background etc. if you look at it on a white page its hard to see nice http://jsfiddle.net/PfQZE/1/ – fred1234 Apr 26 '13 at 10:29
  • If you want I will try to make it look better for you? – chriz Apr 26 '13 at 10:30
  • Sure that would be great I am trying to get a consistent theme here http://donaldswofford.com.108-167-179-73.secure18.win.hostgator.com/ContactUs.aspx – fred1234 Apr 26 '13 at 10:34
  • That looks great is there anyway to put an arrow on there? – fred1234 Apr 26 '13 at 11:06