Align elements vertically in flexbox container using Bootstrap 3 on Internet Explorer 10 and 11

Encountering a problem in IE10+11 when trying to vertically center two Bootstrap columns within a row using flexbox.

The dynamic content in the columns requires the row to have a minimum height of 65px. However, if the content expands and spans multiple lines, the row should be able to grow in height while still keeping the columns vertically centered. This rules out specifying a fixed height.

The issue arises as IE10+11 only support specific height with flexbox, not min-height.

Various attempted workarounds such as display table-cell, float: none, etc., resulted in breaking the column offset in Bootstrap.

Seeking solutions or suggestions for addressing this challenge.

Sample HTML:

<div class="row">
  <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">Title - Can vary in size</div>
  <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">Optional sub title - Can vary in size</div>
</div>

CSS:

.row {
  min-height: 65px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

JsFiddle link here (including vendor prefixes).

Answer №1

One way to address the min-height bug is by utilizing a workaround that involves wrapping the .row in an element with another flex definition, as shown below:

<div class="row-fix">
    <div class="row">
        <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">Title - I can be any size</div>
        <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">Optional sub title - I can be any size</div>
    </div>
</div>

To implement this solution, add the following CSS code snippets:

.row-fix {
     display: flex;
     flex-direction: row;
 }
.row {
    min-height: 65px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

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

What benefits does React offer that jQuery does not already provide?

What sets ReactJS apart from jQuery? If jQuery can already handle everything, why should we use React? I've tried to research on Google but still don't have a clear answer. Most explanations focus on terms like "views," "components," and "state" ...

Exploring "Additional resources" using Selenium and Python

I am looking to extract text from the "Further reading" section of a Wikipedia article. My current code can open Google, input a request (such as 'Bill Gates'), and then find the URL of the corresponding Wikipedia page. Now I need help parsing th ...

Gather data from various HTML elements with JavaScript when submitting a form

How can I extract values from HTML elements and send them for processing through a form? I'm attempting to compile a menu item list with the individual items' structure in place, but I'm struggling to figure out how to fetch the values upon ...

Modify the color of the lower border and dropdown indicator in Material UI's Autocomplete feature

https://i.stack.imgur.com/oXKQm.png I'm struggling to figure out how to change the color of the line underneath 'Search' and the arrow on the right to white. I've tried applying styles to the .MuiAutocomplete-root css class, but it did ...

text/x-handlebars always missing in action

I'm currently working on my first app and I'm facing an issue with displaying handlebars scripts in the browser. Below is the HTML code: <!doctype html> <html> <head> <title>Random Presents</title> ...

Javascript callback function cannot access variables from its parent function

As a Javascript newbie, I am currently diving into callbacks for my project. The goal is to retrieve address input from multiple text boxes on the HTML side and then execute core functionalities upon button click. There are N text boxes, each containing an ...

Creating a Sticky Header and Footer with Responsive Design: Ensuring Content Div Expansion between Them

Greetings. I am working on creating a simple responsive HTML layout as described below: HTML: <div id="header"></div> <div id="content"></div> <div id="footer"></div> CSS: #header{ wi ...

Circular css3 animation originating from the center

Can someone provide an example of how to create a div rotating around a circle in CSS3 while the circle itself is already rotating? I attempted to use webkit frame, but it did not work correctly. If anyone has any examples or tips on achieving this effec ...

JavaScript event/Rails app encounters surprising outcome

I have encountered a strange bug in my JavaScript code. When I translate the page to another language by clicking on "English | Русский" using simple I18n translation, my menu buttons stop working until I reload the page. I suspect that the issue ...

Bring to life a dashed slanted line

After incorporating the code from this post on Stack Overflow about animating diagonal lines, I was pleasantly surprised with how well it worked. However, my next goal is to style the line in such a way that it appears dotted or dashed, as opposed to one ...

What are the signs that an element was visible on screen prior to navigation?

Recently, I incorporated SlideUp and SlideDown jquery animations into my website. You can check it out by visiting (click the >>>). However, I noticed a small issue where when users navigate to a new page, they have to re-SlideUp the element that was sl ...

The graphic is displayed at a width of 50%

I am currently working on a FrontEnd project and implementing Bootstrap 3 for the grid system. Additionally, I am utilizing art direction with the picture element. However, I seem to be facing an issue with the images. Every time I include the following s ...

Has CSS3 been recognized as an official standard?

Can you confirm whether CSS3 has been officially recognized as a W3C standard or is it currently in the status of "CR" (Candidate Recommendation)? ...

Problem with translating a variable into a selector in JQuery

When attempting to make my Jquery code more flexible, I decided to extract the selector and access it through a variable. However, despite creating variables for both selectors, neither of them seem to be functioning properly. I am confident that the issue ...

Tips for customizing text field appearance in Safari and Chrome

I haven't had a chance to test it on IE yet. My goal is to create a unique style for the background image and text box shape, along with borders, for the search bar on my website, [dead site]. If you check it out on Firefox or Opera and see the sear ...

Struggling to align elements in a navbar using HTML and CSS?

Currently, I'm in the process of building a simple website and focusing on customizing the navbar. The logo within the navbar is created using font awesome and text, with a larger font size compared to other elements in the navbar. However, I am facin ...

Utilize Bootstrap to switch between 'collapse' and 'collapse in' depending on the device being used

I have a collapsible panel set to default "expand" (collapse in) and it is working well. However, I would like to make it "collapse" (shrink) for mobile and tablet devices. Is there any built-in feature in Bootstrap that can help me achieve this? <div ...

The importance of understanding Req.Body in NODE.JS POST Requests

Currently, I am developing a Node.JS application that interacts with a MySQL database. The app retrieves data from the database and displays it in a table using app.get, which functions correctly. The issue I am facing is that when utilizing app.post, re ...

New feature in Chrome allows credit card suggestions to be displayed in the name input field

On one specific page of my angular app, I have an input field for a name that is showing credit card suggestions. When I disable the autofill for credit cards in Chrome settings, it then shows suggestions for names instead. However, on another page with ...

Each block in Svelte includes a unique shorthand attribute

I have a JSON variable that holds attributes in a specific structure: // This json variable defines the attributes for elements to be created let myElements = [ { attr1: "myAttr1", attr2: "myAttr2", }, { ...