Border around dropdown menu

I've been attempting to customize the style of a dropdown menu without success. Here is the desired look:

https://i.sstatic.net/osNYx.png

I experimented with using <select> and Material UI's SelectField, even adding a border style, but it didn't produce the desired effect. Any suggestions on how to achieve this border style?

Answer №1

Have you attempted to customize the select element?

select.custom-select {
  border: 1px solid red;
}
<select class="custom-select">
  <option selected value="1">Custom Option</option>
</select>

Answer №2

This issue is quite common, but you haven't created any div for the select element.

There are two ways to address this problem:

  1. Add a div to your element:
<html>
<head> 
<style>
select.dropdown {
  border: 1px solid black;
}
</style>

<body>
<div>
<select class="dropdown">
  <option selected value="1">Option 1</option>
</select>
</div>
</body>
</html>
2) You can also use the outline property (without the need for a div):
<html>
<head> 
<style>
select.dropdown {
  outline: 1px solid black;
}
</style>

<body>
<select class="dropdown">
  <option selected value="1">Option 1</option>
</select>
</body>
</html>

I hope this clears things up for you.

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

What are some methods for customizing the calendar icon displayed in an input field with type date?

Is there a way to customize the calendar logo without relying on jquery? The desired appearance should resemble the image shown below: https://i.sstatic.net/G06iZ.png input { width: 50%; padding: 8px; border-radius: 10px; ...

How to create a custom CSS style to make Bootstrap 4 modal slide in from the bottom

Back in the days of Bootstrap 3, this was the trick: .modal.fade .modal-dialog { -webkit-transform: translate3d(0, -25%, 0); transform: translate3d(0, -25%, 0); } Another approach that could have been used: .modal.fade .modal-dialog { transfor ...

Eliminate the gaps within CSS3 columns

I'm attempting to achieve an effect that looks like: C---------------------------------------) | Address 1 | Phone Numbers | | Address 2 | Times place is open | (---------------------------------------) However, the spacing with th ...

Is there a way to retrieve all "a" tags with an "href" attribute that contains the term "youtube"?

My goal is to capture all a tags that have the href attribute containing the word youtube. This task requires the use of jquery. ...

smooth upward scrolling and superimposed elements

After exploring the question posed in this thread, I am puzzled as to why setting the slider's scroll direction to vertical does not result in smooth up and down scrolling. Could this issue be related to slick itself, or perhaps the accompanying CSS c ...

Having trouble getting CSS to center text properly. It just won't cooperate

After spending 2 days trying to figure this out on my own, I have come to a dead end. It seems that my lack of expertise in CSS is the root cause of the issue. Here is the code snippet I am working with: <table class="demo"> <tr> <th style ...

Using CSS to create a border hover effect for images

Struggling to implement a hover effect above an image on my Wordpress theme. The border and background with text should appear, but the border ends up being wider and taller than the image itself for some reason. Despite trying various solutions, the borde ...

Adding extra space to the list items in CSS causes the text to become static and unaffected by fluctuations in the line-height

Here's the problem I'm facing: I have a basic list consisting of a shopping cart, login and user registration. I want to adjust the position of the list by adding padding, but every time I do so, the line height also increases. Is there a workaro ...

Bootstrap forms with checkboxes and lineup labels

Here is the HTML code that has been generated: <div class="form-group"> <label class="control-label col-md-2" for="IsWebSiteActive">Website Active</label> <div class="col-md-4"> ...

What could be the reason my header is not displaying in specific browsers?

For some reason, I am encountering an issue with displaying my banner on all browsers except Safari. When I use the inspect element feature, it shows that the banner is there, but it's not visible on the screen. Here is the HTML and CSS code for the h ...

New design in TinyMCE V5: Vertical toolbar labels arranged within a CSS grid layout

When TinyMCE version 5 is placed inside a CSS grid layout, the toolbar labels are displaying vertically. It appears that the "width:auto" property is not being applied correctly, and I am struggling to find a solution to fix it. I would greatly appreciat ...

Issue encountered while trying to interpret Bootstrap 4 within Netbeans 8.2

Currently, I am working on an HTML5/JS application using Node.js in Netbeans 8.2. As I develop the welcome page, I intend to incorporate Bootstrap 4. However, when I attempt to add bootstrap.min.css to my stylesheets folder, I encounter an error as shown i ...

The padding on the Bootstrap button creates the illusion that the button extends beyond the boundaries of the container

Can you help me troubleshoot why the "Subscribe now!" button is extending beyond the container in the image below? How can I align the right edge with the rest of the page, specifically column 12 in the bootstrap grid? I attempted using box-sizing: border ...

HTML5 input placeholder adapts its size and position dynamically as data is being

During my interaction with the input fields on my bank's website, I noticed that the placeholder text undergoes a unique transformation. It shrinks in size and moves to the upper-left corner of the input field while I am entering information. Unlike t ...

Smoothly scroll down to the bottom of the page with a jQuery button using the anchor

Recently, I've been working on setting up a navbar with buttons that smoothly scroll down to specific sections when clicked. However, as a beginner in jquery, I'm having some trouble figuring out how to make it work seamlessly. Can anyone guide ...

Tips on aligning a form element with another element in a Bootstrap column

Is there a more efficient way to position a globe glyph directly to the right of a textbox in multiple places throughout my code, almost touching it? One possible solution is as follows: <div class="col-md-3"> <input class="form-control" ...

Collapse all "Read More" buttons simultaneously using Bootstrap

I am attempting to design a segment that contains multiple paragraphs that can be expanded or collapsed individually. How can I achieve this using only pure bootstrap css so that they do not all expand and collapse simultaneously? #summary { font-size: ...

The Slick carousel code downloaded from their official website is malfunctioning

I found this code on slick's website, but it's not working for me. Can anyone spot what I might be missing? http://codepen.io/anon/pen/pyEddO <html> <head> <title>My Awesome New Website</title> <link rel="styles ...

Clearing selections from a multiple-choice input field

I am seeking to implement a delete feature in a multi-select element similar to the functionality seen here on stackoverflow when selecting multiple tags for a question. Once an item is selected, I would like to display a close icon next to it so that user ...

Can you please explain to me how to target a specific element by its ID in the DOM and then move on to the next element with the same ID using jQuery

During the event handling process, a scenario arises where two div elements end up having identical IDs within the DOM structure. While using JQuery, my objective is to specifically target the second occurrence of the div with the aforementioned ID in the ...