Styling a select drop-down menu with CSS to show a button in Chrome and Webkit browsers

On my HTML page, I have a basic drop down menu set up like this:

<select name="menu" class="menu">
    <option value="a">A</option>
    <option value="b">B</option>
    <option value="c">C</option>
</select>

To customize the appearance, I've added the following CSS styles:

.menu {
    font-size: 10px;
    font-family: Arial, sans-serif;
    padding-top: 2px;
    position: relative;
    bottom: 2px;
    outline: none;
    border-bottom-width: 1px !important;
    border-top-style: none !important;
    border-right-style: none !important;
    border-bottom-style: solid !important;
    border-left-style: none !important;
    border-bottom-color: #999 !important;
    width:200px;
    -webkit-border:0;
    -webkit-appearance: button;
}

In Firefox and Internet Explorer, the drop down menu displays as intended with a single 1px border at the bottom and the grey button on the right side.

However, in Chrome or other WebKit browsers like Safari, the button doesn't show up.

I've experimented with the -webkit-appearance property by referring to this resource , but haven't had much luck resolving the issue.

  • If I remove this property, the menu renders with a box and the button on the right.

  • With the property, I get the desired single 1px border at the bottom, but lose the button.

My question is, how can I ensure that the drop down menu appears correctly in Chrome, similar to how it does in Firefox, with the button on the right and a singular border at the bottom?

Feel free to check out the jsFiddle link for a visual representation: http://jsfiddle.net/tkFpe/3/

Answer №1

To achieve a stylish dropdown menu, consider using a white border for all sides except the bottom which can be in a different color. Take a look at this example on jsfiddle jsfiddle.net/LGwEd/3.

.menu { 
    font-size: 10px; 
    font-family: Arial, sans-serif; 
    padding-top: 2px; 
    position: relative; 
    bottom: 2px; 
    outline: none; 
    width:200px; 
    border:0; 
    appearance: menulist-button; 
}

Answer №2

To get it working, simply delete the -webkit part and replace it with border: 0 and appearance: button;

Success using Chrome version 25.0 and Safari version 6.0.2 for me.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Struggling to properly center my logo vertically

At my website, the logo in the top left corner is not centered. Here is the code I am using: .header_col1 { float: left; width: 20%; background: #009240; text-align: center; position: relative; } .header_col1 a { /* my logo */ d ...

The input field will display a border when it is actively selected

I am currently designing a form where the label should be positioned on the top border line of the text box. [![enter image description here][1]][1] Here is the code snippet: <div class="container"> <div class="row"> ...

Unveiled absolute positioned element disrupts page layout when revealed

I'm facing an issue where an absolutely positioned element is causing content to move when it's displayed. You can see the problem in action by clicking on Profile in this fiddle. Can anyone help me understand what is causing this behavior and h ...

Floating TDs table after four consecutive columns

I am in need of a table that will consist of 4 TDs in each row and then automatically move to a new row. In the HTML, I prefer only listing the TDs because I plan on adding more cells constantly and require them to stay in alphabetical order without having ...

Tips for adjusting the maximum height of the column panel within the DataGrid element

I'm trying to adjust the max-height of a column panel that opens when clicking the "Columns" button in the Toolbar component used in the DataGrid. I am working with an older version of @material-ui/data-grid: "^4.0.0-alpha.8". https://i.stack.imgur.c ...

Ways to conceal just a portion of the bootstrap sidebar?

I'm looking to create a sidebar using 'vue-bootstrap' that can be hidden when clicked, but I only want to hide 80% of the width of the sidebar. How can I achieve this effect of partially hiding the sidebar? <b-button v-b-toggle.sidebar-1 ...

Is it possible for bootstrap to be integrated with specific CSS styles?

I want to utilize bootstrap to create some columns using predefined classes like .col-sm-, and include additional widths for smaller phones. Despite seeing the layout looking fine on Chrome and a few devices, Netbeans throws a "class not found" message for ...

Developing shapes using CSS and jQuery

I am struggling to create the exact contour as shown in the image. Despite trying, I have not been successful in achieving it. I used a lot of HTML child tags in my attempt, but I would prefer to keep it minimal. Is there a simpler way to accomplish this? ...

It is not possible to decrease the size of the image that is currently used as the background image

Three images are arranged in this manner: https://i.stack.imgur.com/u4PdK.png The HTML code for this setup is as follows: <div class="lb-controlContainer"> <div class="lb-closeContainer"> <a class="lb-close"&g ...

How to obtain the full path of a file downloaded using a Chrome extension

Currently in the process of creating a chrome extension that has the functionality to download specific files from various webpages. For this purpose, I have designed a popup.html where users can input the desired name for the file to be downloaded. Additi ...

Innovative dropdown menu featuring images and informative text snippets

I have a question about creating a menu similar to the one on http://www.resellerclub.com that includes images and text details. Are there any ideas on which technologies were used or if there are any commercial solutions available for this? Thank you. ...

Center an image of varying height within a container of fixed height

I have this HTML structure, and while I am open to making changes, I would prefer to keep it simple: <div class="c"> <img ...> </div> The image within the div will vary in size and I want it to be vertically centered. Currently, I ...

Capturing data from button inputs and the timing intervals between presses

I am currently facing a challenging ajax/php issue: In my project, there are 4 buttons that, when pressed, log the press event to a text file using a string representation. This string is named foo1 For example, if I were to press the first button 3 tim ...

Is the background image slowly disappearing?

Instead of using the background property for a background image, I have opted for a different style. Here is how I implemented it: <div id="bg"> <img id="bgChange" src="image/image.jpg" /> </div> This is the corresponding CSS code: ...

The changing perspective in relation to the current position of a background

I am currently working on implementing a parallax effect, which is mostly successful. However, I have encountered a minor issue. Instead of the parallax effect being relative to the element's current position, it abruptly jumps to position 0. How can ...

Spinning a hidden overlay image with CSS

I'm facing a challenge with my mask-image in CSS. I have successfully positioned it using the mask-position property, but I can't seem to figure out how to rotate it without rotating the entire element. Can anyone provide insight on how to achiev ...

Using SVG as a background image on Internet Explorer with zoom capabilities

I am having an issue with my SVG used as a background image: <div class="bubble"></div> Here is the CSS I am using: .bubble { background-image: url(https://beta.creasoft.cz/Images/bubble-small.svg); background-repeat: no-repeat; width ...

Adjust the header's alignment to seamlessly coincide with the uppermost part of the

I'm encountering this peculiar issue with a website I recently started designing. My aim is to make the header perfectly aligned with the top of the page. However, despite my attempts, there persists a stubborn gap that measures around 20px, defying a ...

The current version of ChromeDriver is incompatible with the installed Chrome browser, which is causing the SessionNotCreatedException: Message: session not created error to occur. Chrome

My current browser is Chrome 75 and I've downloaded the compatible Chromedriver for Linux. I have added it to the PATH variable as directed. However, upon trying to initialize a driver using driver = webdriver.Chrome(), I encountered the following err ...

Bootstrap 4 - Customizing CSS with zero global styles involved

I'm currently working on a unique control that is directly integrated into the parent page, without the use of an iFrame. This custom control utilizes react-bootstrap, so the bootstrap4 css is automatically included alongside my implementation. Durin ...