Concern regarding the width of select forms in Internet Explorer

When coding a select dropdown box using simple HTML, I encountered an issue where it displayed properly in Google Chrome and Firefox, but not in Internet Explorer. In IE, the dropdown became too long and extended out of the box.

I attempted to set the width and max-width properties of the select class to 100%, but this did not resolve the problem.

https://i.sstatic.net/SeQVx.jpg

.form-parent {
    .form-container {
        input {
            border-color: $ThemeColorLightGray;
            background-color: $ThemeColorLightGray;
        }
    }
}

.form-container {
    display: inline-block;
    width: 100%;
    padding: 0 0 40px;

    .form-control,
    .base-datepicker[readonly] {
        border-color: $ThemeColorLightGray;
        background-color: $ThemeColorLightGray;
    }
    .form-tooltip {
        display: inline-block;
        position: absolute;
        }
}

.form-control {
  display: block;
  width: 100%;
  height: calc(2.25rem + 2px);
  padding: .375rem .75rem;
  font-size: 1rem;
  line-height: 1.5;
  color: #495057;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #ced4da;
  border-radius: 0;
}

select {
  -webkit-writing-mode: horizontal-tb !important;
  text-rendering: auto;
  color: black;
  letter-spacing: normal;
  word-spacing: normal;
  text-transform: none;
  text-indent: 0px;
  text-shadow: none;
  text-align: start;
  white-space: pre;
  -webkit-rtl-ordering: logical;
  cursor: default;
  font: 400 13.3333px Arial;
}
<form method="POST" action="" class="custom-form form-parent js-flex-box">
  <div class="form-container">
    <fieldset>
      <div class="form-group">
        <div class="groupOrder" style="width: 100%; overflow: hidden; background-color: red;">
          <select name="Hotel" placeholder="Choose hotel" title="Choose hotel" aria-label="Choose hotel" class="pham form-control pristine touched" aria-required="true" aria-invalid="false" style="overflow: hidden !important; float: right;">
            <option value="" selected="selected">Choose hotel</option>
            <option value="Wakeup Copenhagen">Wakeup Copenhagen, Bernstorffsgade</option>
            <option value="Wakeup Copenhagen, Borgergade">Wakeup Copenhagen, Borgergade</option>
            <option value="Wakeup Copenhagen, Carsten Niebuhrs Gade">Wakeup Copenhagen, Carsten Niebuhrs Gade</option>
            <option value="Wakeup Aarhus, Bruunsgade">Wakeup Aarhus, Bruunsgade</option>
          </select>
        </div>
        <div class="form-tooltip">
          <div style="display: none;">This field must be filled out</div>
        </div>
      </div>
    </fieldset>
  </div>
</form>

Answer №1

It was suggested to enclose the code in an additional main container, which helped resolve the issue.

Main modifications:

Enclose in a main container

<div class='mainCon' style='background-color: red;width: 80%;'> 
........
........
........
</div>

Then, update the CSS:

#mainCon
{
  display: block;
  background-color: red;
}

.pham {
    width: 100%;
}

#mainCon
{
  display: block;
  background-color: red;
}
.form-control {
    display: block;
    width: 100%;
    height: calc(2.25rem + 2px);
    padding: .375rem .75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0;
    }
   
   select {
    -webkit-writing-mode: horizontal-tb !important;
    text-rendering: auto;
    color: black;
    letter-spacing: normal;
    word-spacing: normal;
    text-transform: none;
    text-indent: 0px;
    text-shadow: none;
    text-align: start;
    white-space: pre;
    -webkit-rtl-ordering: logical;
    cursor: default;
    font: 400 13.3333px Arial;
}
<div class='mainCon' style='background-color: red;width: 80%;'>

<div class="form-group">


  <div>
  <input type='text'>
  </div>

<div>
  <input type='text'>
  </div>
  <div>
  <input type='text'>
  </div>
<select name="Hotel" placeholder="Vælg hotel" title="Vælg hotel" aria-label="Vælg hotel" class="pham form-control pristine touched" aria-required="true" aria-invalid="false" style="width: 100%;">
    <option value="" selected="selected">Vælg hotel</option>
    <option value="Sample1">Sample 1</option>
    <option value="Sample2">Sample 2</option>
    <option value="Sample3">Sample 3</option>
    <option value="Sample4">Sample 4</option>
  </select>
  <div class="form-tooltip">
    <div style="display: none;">Dette felt skal udfyldes</div>
  </div>
</div>

 <div>
  <input type='text'>
  </div>

<div>
  <input type='text'>
  </div>
  <div>
  <input type='text'>
  </div>

</div>

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

How to access a value from a for-loop in JavaScript beyond its scope

Hello there! Within nested json-files, I have been utilizing the following function for iteration: function organizePeopleGroups(People, container, parentObject) { _.each(People, function (item, index) { var peopleGuid =[]; for (var p ...

I need to access the link_id value from this specific actionid and then execute the corresponding function within the Ionic framework

I have a JavaScript code in my TypeScript file. It retrieves the attribute from a span element when it is clicked. I want to store this attribute's value in a TypeScript variable and then call a TypeScript function. Take a look at my ngOnInit method, ...

Using ngrx to automatically update data upon subscription

Background The technology stack I am using for my application includes Angular 4.x, ngrx 4.x, and rxjs 5.4.x. Data is retrieved from a websocket as well as a RESTful API in order to share it between multiple components through ngrx. Currently, data is ref ...

The directive 'templateUrl' points to the route '/'

I'm having an issue with using the templateUrl in a directive to load a partial. Whenever I try to visit the URL for the template, it redirects me back to /. This results in the partial loading the entire page instead of just the requested partial. a ...

Adjust element based on the position of another element (sticky)

Is it possible to rotate a text block so that it remains anchored to the bottom of a red rectangle, even when the rectangle is rotated? Similar to how it works in Figma, but simpler. For example, if I rotate the rectangle by 180 degrees, the text should be ...

Error: Invalid JSON format - token 'o' found at index 1

Working with a type class in my controller, I am currently parsing data and receiving it in the following format: { "data": { "userList":[ { "id":1, "name":"soni ...

Enhancing an Image Gallery using CSS

Currently in the process of building a website for an upcoming event, and naturally, I need to create an event calendar. For inspiration, I have been referencing this example for its gallery layout and hover effects. However, I am hoping to customize thi ...

What could be causing this SVG with CSS animation to appear cropped only in Firefox?

The SVG animation in the hero section of this webpage appears to be cropped only on Firefox. Despite trying a jQuery solution to force the size of the SVG to match the window dimensions, the issue persists. Further investigation is needed to resolve why th ...

"Incorporating Adobe Edge Animate alongside AngularJS and AngularUI Router for dynamic web design

Currently, I'm in the process of integrating multiple animations created using Adobe Edge Animate into a single AngularJS application for a project. These animations will serve as the visual elements for a game, with player input controlling the compo ...

Challenges arising from the use of 'position: absolute' in managing relationships between grandparents, parents, and children

Within my React project, all code is enclosed within the root div (grandparent). In my Project.js component, there is a separate div (parent) solely responsible for the background color. This component is then displayed in App.js without any additional d ...

Is it possible for the sum to turn into NaN in Bootstrap Table JavaScript?

I used bootstrap to create a table that links with phpmyadmin. I need to show the total current amount in the table, which should update when using the search function. However, I keep getting NaN as my result. Below is the relevant code: // PART OF CODE ...

Leverage the source code of Angular 2 in your project for seamless integration

Currently in the process of setting up Angular with npm: npm install @angular... Encountering an issue where the TypeScript source files are not included. I would like to have access to debug the code using the TypeScript source files (with source maps). ...

Tips for optimizing content loading without a full page refresh using Ajax

As a newcomer to the world of coding, I am currently working as a beginner webdev specialist. My boss has tasked me with enhancing the website in a way that only the inner content is reloaded when the page is refreshed while keeping the top panel, side bar ...

The JQuery mmenu breaks free from its constraints within a Bootstrap 4 design

Whenever I zoom in on my page or view it in responsinator.com, particularly in landscape view, the menu fails to collapse into the mobile version. I have implemented the jquery mmenu plugin alongside bootstrap 4 justified nav. After attempting to remove ...

"Use Jquery to automatically scroll back to the top of the page after opening a new window

Currently, when a button is clicked, I am opening a new window that takes me to a specific website. However, in addition to this, I also need the new window to scroll down slightly once it opens. This is how I am currently achieving this: $(document).read ...

Why does running the code result in the error mentioned above?

Uncaught ReferenceError: Unable to process binding "value: function (){return sumValBinding }" Message: sumValBinding is not defined Here is the HTML code snippet: <div class="form-group"> <label for="inputdefault">First numbe ...

Background image design for mobile using Bootstrap

On my website, I have a background image set. However, I noticed that when viewing it on a mobile device, the background image appears in different sizes on different pages, even though they are all linked to the same stylesheet and use the same code. You ...

Creating a JavaScript regular expression for formatting time input without using any external plugin

As I work on implementing a time input mask with the meridian of am|pm without using an input mask plugin, I've encountered some challenges. The input should not allow the user to start with alphabets, but my current pattern, although it works, clears ...

What is the best way to perfectly center my CSS menu in a fluid style layout?

Can you assist me with this issue? I am trying to center my CSS menu precisely in the middle of the user's screen, both vertically and horizontally. Since users have varying screen resolutions, I need a fluid example to achieve this. Below is the HT ...

Best method for reverting react-native to previous version

Here's the dilemma I'm facing: I had a functional version of a react-native project that was running smoothly and committed to my git repository. Deciding to upgrade from react-native 0.26.3 to 0.28 led me into a tangled web of dependencies, so ...