Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extra chrome border on <select> items using rounded corners

I have an issue in Chrome where there are "two" borders when I use rounded corners on a select menubox (see below, the top is an input box and the bottom is the select box)

Two borders

input, select { 
    border:2px solid #ced6e9; 
    -moz-border-radius:8px; 
    border-radius: 8px;
}

I've tried two other approaches, but they don't work:

  1. Rounded corners in Chrome not working doesn't work and

  2. setting -webkit-appearance: none; but this removes the little button indicating it's a select box

Edit I'm using Windows 7 (service pack 1) with Chrome v18

See this jsFiddle example

like image 544
J Lee Avatar asked Apr 12 '12 14:04

J Lee


People also ask

Which CSS property is used to add rounded corners to the border of an element?

The CSS border-radius property defines the radius of an element's corners. Tip: This property allows you to add rounded corners to elements!

What is used to add rounded borders to an element?

The border-radius property is used to add rounded corners to an element in CSS. The border-radius property is shorthand for the four subproperties used to add rounded corners to each corner of a web element.

How do you round corners of outline in CSS?

Now, to give rounded corners we have to use the border-radius property. The border-radius property is used to round the corners of an element. We can set a single radius to make the corners circular, or two radii to make corners elliptical. This property can contain one, two, three, or four values.

How do you add a border-radius in CSS?

CSS Syntaxborder-radius: 1-4 length|% / 1-4 length|%|initial|inherit; Note: The four values for each radius are given in the order top-left, top-right, bottom-right, bottom-left. If bottom-left is omitted it is the same as top-right. If bottom-right is omitted it is the same as top-left.


2 Answers

Had this problem before and all I did was remove the border on the select and wrap it in a div with the same style (rounded borders). I'm sure there's a more elegant solution but it was better than searching for hours/days for a solution.

Check out this fiddle.

like image 178
Matt K Avatar answered Sep 20 '22 08:09

Matt K


What version of Windows are you using? Sometimes the OS will force additional graphical quirks onto certain HTML elements. Things appear to behave as desired in Chrome 18 on Windows 7 with an Aero theme enabled. I actually answered a similar question yesterday with an example for styling select element to replace the graphical elements lost with -webkit-appearance: none: https://stackoverflow.com/a/10074928/1030243. Hopefully, if no other solution is found, you can implement it with a few extra lines of CSS.

like image 30
Aaron Avatar answered Sep 20 '22 08:09

Aaron