What is the best way to eliminate all borders from a select box?

Is there a way to completely remove all borders from the selectbox using either CSS or JQuery?

The code snippet is as follows:

<select id="doctor_ch">
   <option value="1" selected>One</option>
   <option value="2">Two</option>
</select>

This is the CSS being used:

#doctor_ch{
    background-color: #88AFF2; 
    color:#fff; 
    margin-top: 15px;
}

However, this code only changes the arrow style. I also would like to remove the background of the arrow. How can I achieve this?

Current output:

Desired output:

View on jsfiddle

What steps should be taken in order to accomplish this task?

Answer №1

When using Firefox, there may be issues with the select-background feature. To workaround this problem, you can use the following code to remove the arrow and replace it with a background image of your choice (I used an icon from a Google search as an example)

This is how it looks on FireFox (Feel free to replace the arrow icon):

#doctor_ch{
    background: url('http://s4.postimg.org/5yxladijd/icon_sort_down.gif') no-repeat right #88AFF2;
    color:#fff; 
    padding-right:15px;
    margin-top: 15px;
    appearance:none;
    -moz-appearance:none; /* Firefox */
    -webkit-appearance:none; /* Safari and Chrome */
 }
<select id="doctor_ch">
    <option value="1" selected>One</option>
    <option value="2">Two</option>
</select>

Answer №2

Give it a shot

background-color: #4ABDFF; color:#ffffff; margin-top: 20px; border:none;

Answer №3

To modify the CSS, follow these steps:

#clinic_spec{
    background-color: #D1E5F9; 
    color:#333; 
    margin-top: 20px;
    -webkit-appearance:none;
}

Next, you can create a triangle shape using CSS for the element with id "clinic_spec" by adding :after pseudo-element.

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

Effortlessly browse through directory with the seamless integration of AngularJS or

Hey there! I'm working on a really cool feature - creating a list with editable inputs. However, I've encountered a bit of an issue. Is there any way to navigate through this list using arrow keys and focus on the desired input? .content ul { ...

Issues with the local or browser display of @font-face

I'm really struggling to get my @font-face to display correctly, whether I view it locally or in the browser preview. This is the CSS code I am using: @font-face { font-family: chopin-script.regular; src: local('chopin-script.regular'), ...

Guide to creating HTML file with SSI tags

Currently, my website uses Nginx SSI tags to dynamically include template files such as the header, footer, and sidebar. However, I need to provide the final HTML output to clients instead of running it on their browsers. The issue I'm facing is that ...

Creating background color animations with Jquery hover

<div class="post_each"> <h1 class="post_title">Single Room Apartments</h1> <img class="thumb" src="1.jpg"/> <img class="thumb" src="1.jpg"/> <img class="thumb" src="1.jpg"/> <img class="thumb last" ...

Move the cursor within the text area upon clicking the button

When the "+header" button is clicked, I am looking to automatically position the insertion point inside the text area. Currently, after pressing the button, the text box displays information like address, date, time etc. but the cursor does not start insid ...

What do you call the syntax %< ... >%?

Observed zoomInAnimation : true, zoomOutScale : false, templateLegend : "<ul class=\"<%=type.toLowerCase()%>-legend\"><% for (var j=0; j<sections.length; j++){%><li><span style=\"background-color:<%=section ...

Apply a new class to an element's id using jQuery

Looking for a way to change the plus symbol to a minus symbol when clicked in my HTML code. <div class="col-3"> <a href="#tab-1"> <span class="plus" data-tab="tab-1">+</span> </a> </div> <div class="col-3"> & ...

Loading a specific CSS file along with an HTML document

Creating a responsive website, I'm looking to incorporate a feature that allows for switching between a mobile version and a standard desktop version similar to what Wikipedia does. To achieve this, I would need to reload the current HTML file but en ...

Exploring the power of AngularJS through nested directives

Index.html: <nav-wrapper title="Email Test"> <nav-elem value="first"></nav-elem> <nav-elem value="second"></nav-elem> </nav-wrapper> app.js: app.directive('navWrapper', function() { return { ...

Is it possible to retrieve values from my model when working with Django Templates and incorporating them in the JavaScript header?

With Django, I have managed to successfully retrieve and display data from my model in the content section of the template. However, I am facing issues retrieving data from the model in the header section of the template. Below is the code --> view.py: ...

Is there a restriction on the number of stylesheets per page in Internet Explorer 8?

Discussing the limitations of CSS in a forum thread, a user shared insights: A user mentioned that Internet Explorer has is known to have a restriction of 4096 CSS rules per file. For more information, check out this source. Additionally, there might be ...

What is the best way to consistently display a scroll bar at the bottom?

How can I ensure that the scroll bar is always at the bottom when loading pages? I need an immediate solution. The JavaScript code seems to be malfunctioning. Please assist me in resolving this issue. #student_name{ height:315px; } <div id ...

Obtain the contents of a div element from a specified URL

Having trouble with my side menu and hide/show div functionality. When I click the back button, the content of the previously viewed div does not appear. How can I fix this issue? I've looked into using jQuery pushstate but it's still confusing t ...

Reset the AJAX object using jQuery

Currently, my code looks like this: object1 = $.ajax({ .. .. }); If an error occurs, I would like to have the ability to restart the ajax request. For instance, if the user's connection is lost, I want to be able to easily call the same ajax again w ...

Flask - Refreshing Forms Dynamically

In an effort to enhance the responsiveness of my app, I am looking for a way to prevent the page from reloading every time a POST request is sent. My current setup includes a dynamically generated form with input fields designed like this: <div class=&q ...

Unusual occurrence with the nth-child selector

For the fiddle, click here - http://jsfiddle.net/ashwyn/a45ha/ To see the HTML code, take a look below: <div class="parent"> <div class="a">Class A</div> <div class="b">Class B1</div> <div class="b">Class B ...

Correcting the reference to "/" (root) for assets after relocating the site to a subdirectory

I currently have a website located in the public_html directory, where all assets (images, css, js, etc) are referenced using /asset_folder/asset. The "/" at the beginning ensures that the browser starts from the root and navigates through the directories. ...

Instructions on inserting a new row beneath a selected row using jQuery

https://i.stack.imgur.com/AlwHm.png When the second column is clicked, the method below is called: function getListOfList(primaryId, isFlat, col) { alert(primaryId) $.ajax({ url : ("/" + serverURL + "/dataGrid/getChilds"), ...

The Calibri Light font is not supported by Chrome version 37

Yesterday my website was working fine, but today when I checked it, some strange issues appeared. The Calibri Light font that I used extensively has been replaced with the default font, and the width of input fields has changed. How can I resolve this issu ...

Invoking a function to display text when a selection is changed

I am trying to implement a jQuery function that displays a dropdown list with the options "One" and "Two": <select name="filter" data-userid="3" onchange="getPoints(this.value)"> <option value="one">One</option> <option value= ...