IE 11 is giving me trouble with max-width functionality

As a new designer, I recently created my own WordPress theme that functions perfectly on FireFox, Chrome, and Opera. However, I encountered an issue with InternetExplorer (I'm using Windows 7 with IE 11).

It appears that InternetExplorer 11 does not recognize the max-width CSS property. Here is the CSS in question:

.vi-container {
    margin: 0 auto;
    position: relative;
    width: 100%;
}

.vi-content {
    margin: 0 auto;
    max-width: 1200px;
    overflow: hidden;
}

The HTML code looks something like this:

<div class="vi-container">
    <header class="vi-header">Header stuff</header>
    <main class="vi-content" itemtype="http://schema.org/Blog" itemprop="mainContentOfPage" itemscope="" role="main">
        <article class="post-content-wrap" itemtype="http://schema.org/BlogPosting" itemprop="blogPost" itemscope=""></article>
        <!-- more articles with contents -->
        <aside class="vi-sidebar" itemtype="http://schema.org/WPSideBar" itemscope="" role="complementary"></aside>
    </main>
</div>

The max-width of 1200px is being completely disregarded by InternetExplorer. You can observe this by loading my webpage in IE and comparing it to other browsers. For example:

Here is an example JSfiddle link: http://jsfiddle.net/z4s01yxz/

I have come across similar discussions on StackOverflow regarding max-width issues in IE but haven't been able to resolve it myself. Hence, I am seeking assistance. I hope someone can help me with this. Thank you in advance.

The current issue lies in how the webpage expands to fill the entire width in InternetExplorer because the max-width property is being ignored. You can view this image for a visual comparison: i.imgur.com/kGr8wk1.jpg

P.S: Apologies for any language mistakes.

Answer №1

It seems like the issue may not be related to max-width, but rather to the main element...

Keep in mind that the main element is not fully supported by IE11 (source).

Here are 2 possible solutions:

Answer №2

Having a specific condition, such as dealing with an image nested within parent divs in a table layout, can present some challenges. In my case, the objective was to center the image both vertically and horizontally while ensuring that larger images are not distorted by setting max-width to 100%. To achieve this functionality, I implemented the following code:

.cmp-logo {
  display: table;
  table-layout: fixed;
  width: 100%;
  height: 100%;
}
.td {
  display: table-cell;
  vertical-align: middle;
}
.td img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 260px;
  margin: 0 auto;
}

It's worth noting that without the inclusion of table-layout: fixed in the CSS, the desired max-width behavior may not be properly supported in older versions of Internet Explorer (specifically IE11 and below).

Answer №3

implement this,

style: -ms-grid; -ms-grid-columns: min-content;

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

Scrolling horizontally in a container using the mouse wheel

Is there a way to enable horizontal scrolling in a div using the mouse wheel or drag functionality with jQuery? I attempted using draggable, but it did not work effectively in my specific code scenario. Currently, I have a horizontal scrollbar. Are there ...

The image tag fails to appear on the browser when the client attempts to access it

Greetings, I am new to web development. I am attempting to create a simple static website that only displays an image in the header tag of an HTML file. The server seems to be working correctly in sending responses to the client, but the problem lies in t ...

Creating dynamic pages using user input in Node and Express

Currently, I am facing a challenge in rendering text using node/express. Within my project setup, there is an HTML file containing a form. The file named search.ejs looks like this: $(document).ready(function(){ var userInput; $("#submit-button-i ...

A step-by-step guide to displaying a list with material icons in a React JS application utilizing the Material

I tried implementing a dropdown list with Material-UI, including an icon on the left side. However, after following the documentation and adding the code for the icon, the dropdown list stopped working. InputProps={{ startAdornment: ( ...

Tips for including shared information across different ionic tabs

Is there a way to include some shared content, like a canvas, in between the content of different tabs in Ionic? I want this common content to be displayed across all tabs, while each tab still shows its own dynamic data below it. I attempted to add the c ...

Having issues with the functionality of Bootstrap 4 sticky-top feature

How can I make the sidebar stick to the top across different screen sizes? It works fine for smaller screens up until the 'sm' breakpoint, but beyond that, it doesn't stick. I've tried adjusting the order of class names, but it didn&apo ...

JavaScript is unable to execute anything that comes after the initial code, specifically document.get

<section class="blogSingle"> <div class="container"> <div class="row"> <div class="blogSingle-left col-md-8"> <div id="content3" class="blogSingleContent"></div> </div> <div class ...

Limiting the scope of elements in HTML and JavaScript through the use of namespaces

Recently, I've been noticing a trend where Developer A creates a new feature, such as an autocomplete input, without using any frameworks, combining HTML and JavaScript in the same file. The code for the feature might look something like this: <!- ...

The CSS does not display properly on iPad or mobile devices

Recently, I had the opportunity to design a website for a local music school. This project was a great learning experience that has shown me the importance of continuous improvement and practice. Check out the site here Initially, I wanted to make the w ...

The function CGI::escapeHTML() is ineffective

I am just starting to learn CGI programming and I am having an issue with my code. The output currently displays: Hello, "<h1>Tom Cat</h1>"! It seems that the escapeHTML() function is not working as expected. I am developing my CGI code usin ...

After being redrawn, the line on the canvas vanishes

After updating the angle value, the line is quickly redrawn correctly but then disappears. It seems like the input value may be getting refreshed and set to undefined again. How can I ensure that the line retains the correct angle? <script language=" ...

Tips for ensuring only one submenu is open at a time

I have successfully created a responsive menu that is working well. However, I am facing an issue. I want only one menu to be open at a time. When a submenu is opened, the other menus should be hidden. How can I achieve this? Below is my Script code $( ...

When a Mui Button is clicked, it changes the color of all tabs instead of just the active

My website footer contains 5 links represented by Mui Buttons with the component set to {Link} in order to transform them into clickable links. Currently, all the buttons are black and change to green when hovered over. However, I want the button color to ...

What is the best way to arrange my crimson blocks to sit next to each other?

Is there a way to align the red boxes side by side with some space in between them for separation, and how can I ensure that the signin/signup button appears against the blue background of the header? I attempted using float but encountered issues. The d ...

Expanding the size of a text area input within a form using CSS and

How can I adjust the size of the text area in the Comment section to match the full width of the section, starting from the beginning instead of the middle? You can find the code here. HTML <body bgcolor="#00BCD4"> <div> <h1>Co ...

Guide to showing a form following a button click in Angular 9

I am trying to create a feature on my page where when I click a button, a form will appear directly below it. Additionally, I would like the number of forms displayed to match the number of times the button is clicked. Being a newcomer to Angular 9, I am ...

Challenges with border-color and CSS input:focus

The dilemma Currently, I am immersed in a project focusing on constructing a front end using bootstrap4. In order to align with the company's main color scheme, I decided to alter the highlighting color of inputs. To achieve this, I made the followi ...

What is the correct way to create a card outline in Bootstrap?

I am currently developing a Django website to enhance my skills in coding, CSS, Html, and Bootstrap. However, I am encountering an issue with the main page of my site. The visuals on my cards do not align properly with the colored boxes at the top of the p ...

Video streaming platform without the need for javascript and plugins

Is it feasible to watch Youtube videos without relying on javascript and plugins, exclusively using HTML5 or a similar alternative? ...

Ways to dynamically update a div with data from a JSON response

I'm currently in the process of developing a search platform. I have three static divs on the search results page that display certain content, all containing similar code. For example: <div id="result" class="card"> <img src="hello.png" ...