Media queries in IE9 for CSS with specific conditions based on the height of

We are implementing a CSS media query to adjust styles for mobile devices, specifically increasing the height of select elements for easier selection. Here is an example:

@media only screen and (max-width: 599px) {
    .mySelect {
        height: 40px;
    }
}

When resizing the browser window, you can observe the select element expanding and shrinking accordingly in Chrome and Firefox, but not in IE9. In IE9, the text gets cut off when the select element shrinks back down. You can view this issue in action on this fiddle: http://jsfiddle.net/7cVbx/. Screenshots illustrating the problem are provided below:

Initial state:

After reducing window size:

After restoring the window width:

I noticed that setting the height of select elements outside of the media query resolves the issue (as shown in the commented part of the fiddle). However, I'm hesitant to apply this solution as it may lead to excessive white space or text cutoff in different browsers.

Is there a more effective approach to handling this? Or should we stick to explicitly defining the height outside the media query to ensure compatibility with IE9?

NOTE: Changing the Browser Mode in IE10 does not replicate this issue; it solely occurs in the actual IE9 browser.

Answer №1

Upon further experimentation, I discovered the solution. Instead of giving the non-media query class an arbitrary height, I simply set it to 100%.

.mySelect
{
    height: 100%;
}

From what I can tell, this change does not affect the select element at all, and IE9 displays it correctly when adjusting the window size. Check out the updated demo here: http://jsfiddle.net/7cVbx/1/

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

Is there a way for me to superimpose text onto an image in this instance?

I am attempting to place a "Text overlay goes here" over the profilepic.jpg image below. I believe there may be an issue with my CSS code. My approach was to create a new div class named overlay and embed that line within the imgcontainer class. Can some ...

Internet Explorer does not display CSS effectively

Having issues with CSS on Internet Explorer While this page displays correctly in Firefox, Chrome, and Opera, on IE the "date bar" is overlapping on the first <li> bar View the issue here: The current CSS code is: #content h2.other-posts { he ...

Tips on organizing elements

Here are three elements: <!DOCTYPE html> <html lang="en"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> <link rel="stylesheet" href="https://maxcdn.boo ...

Using the CSS :not selector to style certain input elements

Is there a way to style ALL input elements except for specific types without using the :not selector? Here's an example of what I tried: input, input:not(type='email') { background: red; } Unfortunately, this approach didn't work ...

Utilizing HTML, CSS, and JavaScript to dynamically add and remove a class from

I've been struggling with a specific issue in my 9-button grid. When I click on a button and it changes color to orange, if I click on another button, both buttons remain orange. What I want is for only one button at a time to be orange - when a new b ...

Using j Query to create custom masks for various formats with the option to include optional digits

Looking for a way to mask the CVV card number..! The masking should allow for either 3 numbers like xxx 123 or 4 numbers like xxxx 4567 I have attempted to implement this with jQuery mask plugin, but it only allows for 4 characters. How can I enable both ...

I am unable to display the content even after setting `display: block` using the `.show()`

Hello there, I have attached my javascript and html code. While in debug mode, I can see that the CSS property 'display: none' changes to 'display: block', but for some reason, the popupEventForm does not open up. Any suggestions on why ...

What is the method to display a caret in regular HTML text with the use of JavaScript?

Currently, I am studying JavaScript and aiming to develop a typing game similar to typeracer.com. The goal of the game is to type accurately and quickly without errors. In this game, users input text into a box, and JavaScript then compares their inputs w ...

A fading transparency box on the border

Looking for a box with varying opacity from left to right (See image for reference - the red marked box has decreasing opacity from right to left). Here is my attempt: .waterMark { background-color: #FFFFFF; float: right; opacity: 0.6; position: ...

What is the best way to send multiple responses from an Express server using res.write and execute a specific action after each write operation?

I currently have an active express server that is sending data using res.write() Fetcher.js function fetcher() { console.log("fetcher function called") fetch('/units.html', { method: "POST", body: JSO ...

Scrolling horizontally is an option depending on the content displayed on the screen

Imagine having a webpage structured like this: <header>...</header> <body> <section id="A">...</section> <section id="B">...</section> <section id="B2">...</section> <section id="C">...&l ...

What is the best method to make a hyperlink within an IFrame open in a new window?

Let me share the code I've been working on: <!DOCTYPE html> <html> <head> <base target="_blank"> </head> <body> <div style="border: 2px solid #D5CC5A; overflow: hidden; margin: 15px auto; max-width: 800px; ...

AJAX GET request for fetching HTML data

After making an AJAX request, HTML code is dynamically added to the page. However, links within this dynamic content do not seem to work, unlike manually added HTML which functions properly. Upon inspecting the page source, empty divs are visible (althoug ...

Tips for designing a doodle logo that includes a magnifier lens effect when hovered over

I have a vision for a unique and creative logo solution that involves incorporating a magnifier glass effect. When a user hovers over a certain area of the logo, I want it to zoom in with a magnifier glass effect. I haven't been able to find much info ...

Middle align an absolutely positioned block within a table cell vertically

Here is the code I am working with: td { border: 1px solid #cecece; position: relative; padding: 80px 20px; } .hint { background: yellow; position: absolute; top: 0; bottom: 0; left: 100px; } <table style="width:800px"> <tr> ...

Is it possible to integrate Bootstrap with RCloud?

While Shiny is fantastic, I have a strong desire to create my own responsive dashboard with custom branding. Is it possible to utilize Bootstrap within RCloud? ...

Ensure a button is automatically highlighted within an active class script

I have created a set of buttons that allow users to change the font family of the text. I would like the border and text color to update automatically when a specific option is selected. Currently, the JavaScript code works well, but when the page first l ...

I am having trouble retrieving images from the /media/ directory. Strangely, everything works perfectly when I try to access them through the index. Additionally, the for loop within the templates is

My settings.py file looks like this: Static STATIC_URL = '/static/' STATIC_DIR = [os.path.join(BASE_DIR, "static")] Media MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/' URLs Code - urls.py from d ...

Ways to determine if a date matches today's date within a component template

I am currently displaying a list of news articles on the webpage and I want to show the word "Today" if the news article's date is equal to today's date. Otherwise, I want to display the full date on the page. Is there a way to compare the news.D ...

Tips for accessing jQuery UI tab elements and adjusting visibility for specific panels

How can I retrieve the panel numbers of jQuery UI tabs and adjust their visibility using CSS? I am looking to identify the panel numbers of each tab and control the visibility of certain tabs. <div id="tabs"> <ul> <li><a href="#"> ...