In Edge and Firefox, images scale perfectly, but in IE11, they appear distorted

After creating a design that showcases two images side by side using Flexbox (css), I noticed that it appears perfectly in Edge and Firefox. The images are displayed elegantly, and when the screen is resized, they scale effectively both horizontally and vertically.

However, upon testing in IE11, it became apparent that the scaling was not consistent. While the width adjusted properly, the height remained static.

I have experimented with various solutions but unfortunately, none have resolved this issue for me.

If anyone has any suggestions or tips on how to tackle this problem, I would greatly appreciate it!

<section>
   <div class="flex">
      <div class="col-topnieuws post-media">
          <img src="images/cont/8663.jpg" alt="Description 1">
      </div>
      <div class="col-topnieuws post-media">
          <img src="images/cont/8664.jpg" alt="Description 2">
      </div>
   </div>
</section>

CSS:

.flex {
   display: flex;
   flex-wrap: wrap;
 }

.flex .col-topnieuws {
   width: calc((100% / 2) - (50px / 2));
   margin-right: 25px;
   margin-bottom: 25px;
   display: flex;
   flex-direction: column;
   flex: 1 1 200px;
}

.post-media {
   position: relative;
   overflow: auto;
}

img {
   width: auto;
   max-width: 100%;
   height: auto;
   margin: 0;
   padding: 0;
   border: none;
   line-height: normal;
   vertical-align: middle;
 }

UPDATE:

Interestingly, adding an "a href" attribute around the image tag seemed to resolve the issue. With this modification, the images scaled correctly as desired.

<section>
   <div class="flex">
     <div class="col-topnieuws post-media">
       <a href="#">
          <img src="images/cont/8663.jpg" alt="Description 1">
       </a>
     </div>
     <div class="col-topnieuws post-media">
       <a href="#">
          <img src="images/cont/8664.jpg" alt="Description 2">
       </a>
     </div>
   </div>
</section>

Answer №1

Eureka! Silly mistake on my part!

I discovered a nested flexbox set to column direction. Removing the display: flex; and flex-direction: column; lines resolved the issue.

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

Steps for aligning an image and text within an icon next to each other

I'm looking to align a small PNG image next to some text within an icon. How can I achieve this? Currently, they are stacked vertically. Here is the current layout - I want the two elements side by side instead. The structure of the division is unique ...

How can we automatically add dividers after a certain number of elements in CSS?

Is there a way to create a responsive layout with CSS that automatically adds a divider after a certain number of elements? For example, I have a set of elements with the class .beers, and I want to insert a .divider element after every 5th .beers element ...

The Semantic-UI Dropdown does not appear when utilizing the sidebar feature

Is it normal for a dropdown in the pusher not to show when using a sidebar? I tried setting overflow-visible but it didn't work. Any suggestions on how to resolve this? Check out this JSFiddle example: https://jsfiddle.net/3djmjhn5/1/ Code: $(&ap ...

Creating a pie chart using Highcharts in a Django framework

Trying to create a pie chart in Django with data from my "Results" model. The model has two fields: +--------+------------+ | result | date | +--------+------------+ | passed | 2017-03-30 | | passed | 2017-02-30 | | passed | 2017-03-30 | | faile ...

Internet Explorer 11 encountering a flaw with absolute positioning

In my web page, everything looks good in Google Chrome, Firefox, and Opera, but I'm facing an issue with Internet Explorer 11. Here is the simplified HTML: <div class="container"> <div class="page-content"> <div id="corner ...

Bottom dynamic div

I have three divs: head, foot and textbox. The head and foot divs are fixed positions, and the third div is partly fixed (margin-top). My query is: How can I adjust the bottom of the textbox's div to accommodate different monitor sizes? Using 100% h ...

What steps can be followed to incorporate a loading gif into this popup and subsequently eliminate it?

These simple inquiries are starting to get on my nerves. I can't keep waiting around for my website designer to resolve this issue. It shouldn't be that difficult... I managed to figure out most of it by researching similar questions, but I could ...

block height has become a constant challenge for me - despite my various attempts, I still cannot seem

Struggling with adjusting the height of my posts. Any help would be appreciated! For more details, please visit: <li> <div class="thumb-img"> <a title="Hiring a Professional Designer for Your Kitchen" href="http://www.mulberrydesignerkitc ...

Tips for updating the primary color in Bootstrap?

How can I customize the primary color in Bootstrap to align with my brand's color scheme? Specifically, I'm using Bootswatch's Paper theme. ...

Fuzzy backdrop for a dynamic navigation bar

Is there a way to achieve a blurred background on a bootstrap 4 navbar? I've attempted using the CSS blur filter, but it ends up blurring all the content within the div as well. Some people have resorted to using SVG to blur whatever is behind the di ...

Looking to use Jquery to translate an image both on and off the screen with full width and height?

Imagine a scenario where a full-screen image remains hidden upon page load. When a user clicks a link, the image smoothly slides up from the bottom of the page. Upon clicking the image, it should smoothly move off the page as if it were being translated do ...

Adjusting the array when items in the multi-select dropdown are changed (selected or unselected)

I am looking to create a multi-select dropdown in Angular where the selected values are displayed as chip tags. Users should be able to unselect a value by clicking on the 'X' sign next to the chip tag, removing it from the selection. <searcha ...

Adjusting the height of an image to be responsive within a Bootstrap

I cannot figure out why this task is proving to be difficult. My goal is to insert an image into a container in such a way that the image adjusts its size responsively. This means that as the width of the column decreases, the image should also shrink prop ...

"Troubleshooting: Why is my Bootstrap modal window only printing a

I've encountered an issue with printing the content of a Bootstrap modal window. Previously, the code I had was working fine but now it seems to be malfunctioning. Content is dynamically added to the form using appendChild() in a separate function. Ho ...

Modify the color of the 'li' element that shares the same attribute value as the current page

I am in the process of creating a website for an architecture company. Currently, I am working on a specific page which you can find here: . Each project falls into a category such as residential, commercial, or education. On each project page, I include t ...

Using CSS to position elements absolutely while also adjusting the width of the div

In one section of my website, I have a specific div structure. This structure consists of two divs stacked on top of each other. The first div is divided into two parts: one part with a width of 63% and another part with a button. Beneath the first div, t ...

The row in the table is not reaching its maximum height

Trying to design a layout with a topbar followed by a split layout has posed some challenges. The main issue I encountered was the need for the width and height to adjust automatically based on the browser size. To address this, I attempted to use a table ...

Tips on verifying if user x has sent over two messages in the chat and concealing their identity

I have a JavaScript chat application that is causing me some trouble. I recently implemented a feature to display user names on top of messages, and while it works well for the first message, I am struggling to hide the user's name when they send subs ...

When the menu mobile is open, I successfully disable scrolling on the body, but I am facing an issue where the desktop page always jumps back to the top

I successfully disabled the scroll on the body, thanks to helpful advice from SO! However, I encountered an issue where the body kept jumping back to the top whenever I opened my mobile menu. If I remove the following code: overflow: hidden;</P </bl ...

As the browser window is resized, the gap between images widens while the images themselves decrease

Hey there, I'm encountering some trouble with the image links at the top of my page. As I resize the browser or change screen resolutions in media queries using percentages, the images are resizing accordingly. However, I'm noticing that as the i ...