Eliminate dropdown arrow in Internet Explorer

I am working on customizing a select element by removing the arrow and adding a different icon. So far, I have successfully achieved this for Firefox, Safari, and Chrome. However, I am facing an issue with IE9.

.styled-select select 
{
    border: 0 !important;  /*Removes border*/
    -webkit-appearance: none;  /*Removes default chrome and safari style*/
    -moz-appearance: none;  /*Removes default style Firefox*/
    background: url('select_icon.png')  no-repeat;
     background-position: 179px 7px;
     text-indent: 0.01px;
     text-overflow: "";
     color: #FCAF17;
     width:200px;
 }

You can view the issue on Fiddle while using IE9. I am looking for a solution to remove the arrow specifically in IE9. Any help on JSFIDDLE would be greatly appreciated.

Answer №1

If you are using IE9, you can achieve the desired result with a workaround recommended by @Spudley. Make sure to adjust the div:before css to match the customized height and width of the div and select element.

For IE10, you can use the following CSS3 code to achieve the same effect:

select::-ms-expand {
    display: none;
}

If you prefer a jQuery solution, you can try using the Chosen.js plugin or create your own custom solution in JavaScript.

Answer №2

If you're looking for a solution, you can check out my custom cross-browser select tag with a unique arrow design on GitHub. This solution works seamlessly on both IE8 and IE9, featuring a custom arrow derived from an icon font.

For a live demonstration of the custom cross-browser drop-down in action, click here and test it across all your browsers to see its compatibility.

Let's dive into the implementation for modern browsers first before tackling the solution for older versions.

Custom Drop-down Arrow for Chrome, Firefox, Opera, Internet Explorer 10+

To achieve a consistent arrow design across these browsers, you can set a common background image for the drop-down arrow.

To do this, reset the default styles for the select tag and apply new background rules as shown below:

select {
    -webkit-appearance: none;
    -moz-appearance: none;
    -o-appearance: none;
    appearance: none;
    background-image: url('<custom_arrow_image_url_here>');
    background-position: 98% center;
    background-repeat: no-repeat;
    outline: none;
    ...
}

By maintaining the appearance and outline rules, you ensure a consistent look for the arrow. The background rules utilize SVG inline images for different arrow designs, positioned 98% from the left for proper alignment.

For correct cross-browser functionality, it's crucial to retain the outline rule while other styles can be adjusted as needed.

Custom Drop-down Arrow for Internet Explorer 8 (IE8) and Internet Explorer 9 (IE9) using Icon Font

Dealing with older versions of IE requires a different approach.

Since there's no direct way to hide default arrows in IE8 and IE9, the solution involves hiding the default arrow section in the drop-down and replacing it with an arrow icon font or SVG similar to other browsers.

Firstly, identify these browsers using conditional classes added to the html tag. Then wrap each select element with a div that includes the icon font class:

<div class="selectTagWrapper prefix-icon-arrow-down-fill">
    ...
</div>

This wrapper acts as a substitute for the select tag.

To resemble a drop-down, the wrapper should have a border as the default select border is hidden. The custom arrow icon font is placed using the :before pseudo class, positioned absolutely to center it.

.ie8 .prefix-icon-arrow-down-fill:before,
.ie9 .prefix-icon-arrow-down-fill:before {
    content: ")";
    position: absolute;
    top: 43%;
    left: 93%;
    font-size: 6px;
    ...
}

You can easily customize the arrow design by updating the background image or icon font class as needed.

Answer №3

If you need to apply the class and pseudo-class combination:

.custom-style is the name of your CSS class

:active is the pseudo-class being used

input.custom-style:active {
  /* Styling for active state */
  background-color: lightblue;
  color: white;
}

/* Additional styling for specific browsers */
input.custom-style:active::-webkit-input-placeholder {
  color: #ccc;
}

input.custom-style:active::-moz-placeholder {
  color: #ccc;
}

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

Rearrange information when the textarea is adjusted in size

One issue I am facing is that when I resize the textarea in my form, the content below the textarea does not move along with it. How can I ensure that the content moves accordingly when resizing the textarea? <form name="contactform" method="post" ...

Shifting text upwards within a document

I'm struggling with CSS and bootstrap as I have limited knowledge in this area. I have multiple divs on a page that I want to align based on our old website design. The problem I'm facing is that one div is larger on the right, causing a lot of ...

What is the best way to target the final child element of a specific CSS class?

I am working with an HTML table and my goal is to remove the border-bottom from the last row, excluding the row with class .table-bottom: <table cellpadding="0" cellspacing="0" style="width:752px;" class="table"> <tr class="table-top">< ...

Ways to enable smooth scrolling feature in Safari

I attempted to implement smoothscroll using a polyfill by adding the following code to the bottom of my body tag: <script src="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e99a8486869d819a8a9b868585c ...

Insufficient width of images in the bootstrap carousel

Is there a different solution to this problem that hasn't been mentioned in the other posts? I've tried all the top solutions from those posts, but my issue still remains. In particular, the "example" code and "Stock" bootstrap carousel appear t ...

Is the table row changing in size when a filter script class is applied?

When trying to filter table rows by category and adding the class filterTr to the element <tr>, I noticed that the width of the <tr> element changes, causing it to no longer align with the <th> element above. I am unsure why this resizin ...

A layout with two columns, one of which has a minimum width

Can a two-column layout be created where one column has a minimum width value? Take a look at the following code: #container { width: 100%; max-width: 1200px; min-width: 960px; height: 600px; margin: 0 auto; } #sidebar { float: left; ...

What's the most effective approach to verify if all visible input fields possess a value? (excluding the use of jQuery validator

In order to ensure that all necessary fields are selected, I need to implement a check upon clicking a button. Below is the HTML code: <input type="text" class="required-entry"> <input type="text" class="required-entry"> <input type="text" ...

Tips on widening a paper to its fullest width while also keeping it versatile and adaptable

How can we ensure that in a React application using Material-UI, the width of a paper always expands to a maximum of 600px, regardless of the width of its contents? We also want to keep the paper flexible, so that when the parent container's width shr ...

Selenium: Discrepancies between browser display and HTML code are evident

When attempting to log in to this page using Selenium and Python, I encountered a discrepancy between the page displayed in the browser and the one described in the HTML code. Both Firefox and Chrome webdrivers yielded the same result. chromedriver = "./c ...

Preserving the initial input values in a secure manner for future reference, utilizing either an object or a

Recently, I've started revisiting a script I created a while back that checks for changes in a form to prompt a message asking 'Would you like to save your changes?'... One thing that's been on my mind is whether I should store the ori ...

Issues with the functionality of customisable list items in a list

I am attempting to customize the appearance of specific list items within a ul element. One li element should be displayed in red font, while another li element should have a hyperlink styled with a different color and an underline rollover effect. The thi ...

Unable to utilize SASS variables in Angular from a global file, even though other styles are functioning correctly

After implementing the SASS code in my component's style, it functions correctly. $test-color: pink; div{ background-color: $test-color; } However, when I transfer the definition to styles.scss, the desired outcome is not achieved. I have attempted u ...

Develop a custom script function for every instance of a @foreach loop

I have a challenge where I need to style automatically generated table rows by clicking on a button. Currently, my code appears as follows: @foreach($tours as $tour) <tr id="{{$tour->id}}"> <td> {{$tour->tournr}} &l ...

What is the process for invoking a websocket from an HTML client?

I have created a WCF Service using netHttpBinding binding and it is hosted on IIS 8 (Windows Server 2012). The interfaces for the service are as follows: [ServiceContract(CallbackContract = typeof(IDuplexCallbackContract))] public interface IHelloWebSocke ...

What steps can I take to resolve the issue of my popup closing automatically upon opening and simultaneously refreshing my webpage?

After creating a popup in my HTML page, when I click on the element that triggers it, the popup appears for a brief moment before automatically closing and causing my page to refresh. Below is the code I am using: HTML Code : <a class="lv-footer" id= ...

What is the reason for using <div class="clear"></div> instead of <div class="clear"/>?

It dawned on me that: <div class="clear"/> can wreak havoc on the layout after a sequence of floating divs, whereas <div class="clear"></div> works perfectly fine. Does anyone have an explanation for this? Here is the CSS being used ...

What is the best way to incorporate data from my Input field into my Vue.JS application's existing data structure

Struggling with integrating new users into my personal project, particularly in passing input values (userName and userAge) to the parent element for addition to playersData. Here is a sample code snippet from the child component: `<template> <d ...

Guide on storing images in a designated folder using CodeIgniter

My code is located in view/admin_view2.php <?php echo form_open_multipart('home_admin/createBerita'); ?> <div class="form-group" > <label class="control-label">upload foto</label> <inpu ...

Utilizing the HTML5 Download attribute for linking to external files

I am currently developing a web application for my own personal needs. One feature I would like to implement is the ability to set the download attribute on certain links. However, I have run into an issue where the files to be downloaded are hosted on ex ...