Styling input elements with CSS Grid is causing resizing issues specifically in IE11

Encountering issues with CSS Grid in IE11. (not surprising, right?)

The grid has 2 columns - the first column contains labels for a form, while the second column holds <input> and <select> elements.

All input elements have a size attribute set to control their length. The uniform width given to all inputs doesn't align with the overall software aesthetics we aim for.

While everything appears fine in Chrome, IE11 forces the input and select elements to be of equal width.

Comparison between Chrome on the left and IE11 on the right:

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

Referencing an example:

#testParms {
  display: -ms-grid;
  display: grid;
  justify-items: start;
  align-items: center;
  -ms-grid-columns: max-content;
  grid-auto-columns: max-content;
  grid-template-areas: "a a";
}

#testParms .labelDiv {
  -ms-grid-column: 1;
}

#testParms> :not(labelDiv) {
  -ms-grid-column: 2;
}

.row1 {
  -ms-grid-row: 1;
}

.row2 {
  -ms-grid-row: 2;
}

.row3 {
  -ms-grid-row: 3;
}
<div id="testParms">
  <div class="labelDiv row1"><label>Label 1</label></div>
  <input class="row1" type="text" size="20" />
  <div class="labelDiv row2"><label>Label 2</label></div>
  <input class="row2" type="text" size="2" />
  <div class="labelDiv row3"><label>Label 3</label></div>
  <select class="row3">
    <option value="1">One</option>
    <option value="2">Two</option>
    <option value="3">Three</option>
  </select>
</div>

Note that the labelDiv divs around the labels address another issue with grids in IE11. Labels placed solely seem to ignore the -ms-grid-row style and aggregate in row1.

Although achieving this layout would be simpler with a table, I'm striving to avoid taking that approach.

Answer №1

The container has justify-items: start applied to it, which is compatible with modern browsers like Chrome. However, there is no prefix for IE11 indicating that this property is not recognized by Internet Explorer.

Although justify-items: start doesn't work in IE11 at the container level, a similar function exists at the grid item level. You can use the following code to apply it:

#testParms > :not(labelDiv) {
  -ms-grid-column: 2;
  grid-column: 2;
  -ms-grid-column-align: start; /* NEW */
}

This is an alternative solution to using justify-self: start at the item level, but it's not necessary since justify-items already covers it at the container level.

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

Beautiful Web Address Exclusively for .html Files

The other day I experimented with converting my html pages into clean urls using some [.htaccess] code: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.html [NC,L] While this successfully worked for my html pages, it c ...

Using Selenium to verify if text appears in bold format or not

<div class="searchCenter largeFont"> <b> 1 </b> <a href="search/?p=2&q=move&mt=1"> 2 </a> <a href="search/?p=3&q=move&mt=1"> 3 </a> <a href="search/?p=4&q=move&mt=1"> 4 </a> < ...

Altering the ASP DropDownList's background color solely with CSS modifications

Is there a way to change the background colors of dropdownlists in my C# web app using CSS instead of specifying each one individually? In simpler terms, I'm trying to avoid having to write out code like this for multiple dropdowns: private void For ...

Is your Jquery validation malfunctioning?

I am currently facing a challenge with required validation on an asp.net page. In order to validate the inputs, I have implemented multiple controls which can be hidden or displayed based on certain conditions. These controls include checkboxlists, dropdow ...

How to vertically center a form element in Bootstrap 4

As a newbie to using bootstrap 4 for the first time, I expected vertical alignment of elements to be easy, especially with flex being touted as the simplest way to achieve this. The issue: Struggling to vertically align my form element within my navigatio ...

Dynamic banner image

I currently have a jumbotron image in the background, but it isn't as responsive and I'm struggling to get the whole image to display properly. Here is what it looks like currently: https://i.sstatic.net/IpuDi.png Here is the full image for ref ...

Varied approaches to managing responsive layouts

I am encountering an issue with the responsive design of a website I am currently developing. Scenario: The website features 3 different layouts for Desktop, Tablet, and mobile devices. These layouts consist of similar components with slight CSS adjustmen ...

Troubleshooting issue: Inability to assign classes to child elements within divs of a designated class

Currently, I am facing an issue while attempting to insert divs into multiple divs that share a common class called ".description". My goal is to assign a unique class to each internal div, but for some reason, this only seems to work for the first div w ...

Modify content once it has been rendered using Jquery

After loading, I want to adjust the style of a specific element. However, I am running into a null pointer issue. function loadFriends() { $("#friendsContainer").load("friends.html"); } selectCurrentSetting(); function selectCurrentSetting() { c ...

Explain the concept of paragraph spacing in Word, including how it is

When working with my ms word 2010 document, I often use the includetext-function to incorporate HTML content: { INCLUDETEXT "test.html" } Here is an example of the HTML code that I am trying to include: <html> <head> <meta http-equiv="Co ...

Invite your friends to join my innovative categorization platform with a user-friendly layout similar

I am currently developing a categorization service and I would like it to function similar to Facebook's invite/tagging feature. Has anyone here had experience implementing this type of functionality before? This includes: Auto-completion based on ...

What is the Process of Rendering CSS/HTML in Web Browsers?

I have a simple question that I haven't been able to find an answer for despite my efforts on Google and Wikipedia. Perhaps I'm not wording it correctly. My query is regarding how the combination of CSS and HTML is displayed on-screen and in a b ...

Disable vertical touchmove events to prevent scrolling vertically, while still allowing for horizontal touch and the use of buttons for scrolling

I am working on an iPad app that includes a jQuery widget with both horizontal and vertical scrolling functionality. I want to disable vertical scrolling via touch events while still allowing users to scroll vertically using buttons (such as a slider). Is ...

App.post is returning a set of empty curly braces as the response

I am currently working on an express.js application that retrieves data from a MySQL database and displays it on the screen. I am also trying to implement an insert functionality so that I can add data to the database via the browser. However, when I post ...

Angular implementation of a dynamic vertical full page slider similar to the one seen on www.tumblr

I'm determined to add a full-page slider to the homepage of my Angular 1.x app After testing multiple libraries, I haven't had much luck. The instructions seem incomplete and there are some bugs present. These are the libraries I've experi ...

Animation is not applied to Bootstrap Collapse on a row within a table

My Bootstrap 4 table has an issue - when I apply the "collapse" class to a table row, it behaves differently compared to applying it to a div element. Clicking "animate div" smoothly animates the target div, but clicking "animate tr" does not animate the ...

What is the best method for implementing a media query in an email generated from a backend system

I have integrated media queries into my backend (Node) email system to display different content based on whether the email is opened on a phone or desktop. Strangely, the media query works properly when the email is opened in a native app (like Yahoo&apos ...

What is the reason behind using 'url' to express background images in CSS, while images in 'img' tags can simply be referenced by

We recently had a web designer create our html/css, and upon reviewing some code updates, I noticed the following: img elements simply reference the path of the image like this: <img src="/images/pic.png"> However, for css (using the background pr ...

Overruled fashion

Here is the HTML code from my custom page: <div class="notes quotes-notification member-savings f-left"> <h2>My Notifications</h2> <ul> <li><b>I need to make some changes in the HTML, different from other pages you have ...

Looking to display a submenu next to its parent element

I have a list that is not in order: <ul> <li>Parent-1 <ul> <li>Child-1</li> <li>Child-2</li> <li>Child-3</li> </ul> </li> <li>Parent-2 <ul> <li>Ch ...