Troubleshooting issue with the ineffectiveness of max-width property in IE8 for

I have encountered a peculiar issue with a webpage I created using ASP.net and normal HTML.

When viewing the page in IE10, all CSS properties work correctly. However, in IE8, the max-width property does not seem to function as expected.

An interesting observation is that when I include

<!DOCTYPE html>

before the <html> tag, it resolves the issue in IE8. But without it, the problem persists.

In my ASP.net master page, I have included <!DOCTYPE html>, but upon running the website, it gets removed, causing compatibility issues with IE8.

Why does ASP.net remove this declaration from the page?

With <!DOCTYPE html>:

Without <!DOCTYPE html>:

CSS for the tile box:

.tilebox {
    color: white;
    height: 60px;
    line-height: 85px;
    margin: 5px;
    min-width: 180px;
    padding: 15px;
    text-align: center;
    width: auto;
   }

And for the parent div:

#boxcontainer {
    height: auto;
    margin: 0 auto;
    max-width: 740px;
    min-width: 200px;
    padding: 0;
    width: 100%;
}

The max-width property does not seem to take effect on the div with id #boxcontainer.

Answer №1

max-width is not included in the CSS definition for Internet Explorer 8. To make it work, I utilize a polyfill, specifically Scott Jehl's respond.js:

https://github.com/scottjehl/Respond

This allows you to enable CSS3 features, such as media queries, to function in older browsers like IE6 - IE8.

UPDATE - It is essential to have the HTML5 doctype for this to work, so ensure that <!doctype HTML> is included in your code.

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

Fluctuating problem arises when placing one div over another div while hovering

Sorry if the title isn't clear. Basically, I have a div that when hovered over, triggers another div to appear with display:block, showing it above the original div. It works well but there is some flickering when moving the cursor over the second div ...

Alignment of UI Divs with CSS Bootstrap and HTML

I am facing an issue with two divs in my UI. One div has a label, and the other contains a file selector. Currently, they are stacked vertically instead of being side by side. https://i.stack.imgur.com/fIz03.png How can I align these divs horizontally wit ...

Setting Background Color for a Specific Tab in CSS

HTML <div class="woocommerce-tabs wc-tabs-wrapper"> <ul class="tabs wc-tabs"> <li class="paym-plans_tab"> <a href="#tab-paym-plans">Contract Deals</a> </li> <li class="simfree-pla ...

Animating planeGeometry with 2D texture/sprite in Three.js

As a beginner in html5 and three.js, I have been playing around with Mesh objects. My goal is to display different Textures on the Mesh and be able to change them later on. Here is a snippet of my code: angelTexture = THREE.ImageUtils.loadTexture("images ...

Sending Angular Material Select Option Value for Submission

HTML: <form id="reg" name="reg" enctype="application/x-www-form-urlencoded" action="http://api.phphotspot.com/v-2/client-register" method="post"> <md-input-container class="md-block"> <label for="country">Country</label&g ...

Highlight a pair of words in a phrase using jquery technology

Only one word in my code is highlighted $(document).ready(function() { let firstword = 'web'; let secondword = 'js'; $(".field.ConditionsAccept>.caption:contains('" + secondword + "'):contains('" + firstword ...

Using Python to scrape the contents of a webpage that contains JavaScript, potentially utilizing the Selenium library

Looking to analyze the contents of a webpage that contains JavaScript. Any suggestions for a more efficient method than using Selenium? If not, when the page is loaded in a browser, it contains the following elements: <div class="js-container"> ...

What is the reason for the background image not appearing while utilizing a bootstrap template designed for it?

I recently started working on an asp.net application and decided to integrate a pre-made bootstrap template for the frontend. After some searching, I came across this one. The original site showcasing the template looked really appealing with a background ...

Using *ngIf and *ngFor in Angular to switch between divs depending on their index values

Is there a way to toggle between two divs based on the index value using *ngIf in Angular? I have attempted to do so by toggling boolean values of true and false, but my current approach is not working. Here is what I have tried so far: <div *ngFor=&qu ...

Disabling padding on TwitterTweetEmbed component in React Twitter Embed

Having an issue with Material UI and React Twitter Embed, unable to remove top and bottom margins. Here's the code snippet causing concern: const styles = theme => ({ listItem: { padding: '0px', }, tweetSize: { margin: 0, ...

Hovering over the Star Rating component will cause all previous stars to be filled

I'm in the process of creating a Star Rating component for our website using Angular 11. I've managed to render the 5 stars based on the current rating value, but I'm having trouble getting the hover styling just right. Basically, if I have ...

Animating a spinning SVG path around its center within a larger rectangular box

Is there a way to rotate a smaller SVG path within a larger rectangle around its own center? The current code rotates the entire space. <animateTransform attributeType="xml" attributeName="transform" type="rotat ...

Using JavaScript or JQuery, is there a way to retrieve the favicon icon, Apple-touch icon, and title of a webpage?

Is it possible to extract just the favicon icon and title from a webpage using only an IFrame? For example, for a site like www.stackoverflow.com, I want to retrieve only its title and favicon icon/Apple-touch-icon. Are there any plugins or parsers avail ...

Unable to create a user in ASP.NET Core, as a result of encountering this error: The entity type instance cannot be tracked as there is another instance with the same key value

UserManager [HttpPost] [ValidateAntiForgeryToken] public async Task<IActionResult> RegisterUser(RegisterUserDetailsForm registerUser) { try { // Generating a unique User ID var previousUserId = FetchLastUserId(); // Im ...

Is it possible to enhance the GamepadAPI's functionality?

I've been working on enhancing the built-in GamepadAPI by adding custom controller code. With TypeScript, I created a basic function to trigger a "gamepadconnected" event. // emulate gamepadconnected event function dispatchGamepadConnectedEv ...

Problem with the fixed header on a container causing a horizontal scroll bar

This scenario presents a bit of a challenge! I could solve it by adjusting the container's height, but that would disrupt the fixed position of the sticky header. My goal is to have a scrollbar visible in both the X and Y directions on the .scrollabl ...

The form reappears on the screen once the value has been successfully transferred to the PHP script through AJAX

My main challenge was sending data from an HTML form to PHP code to compare the selected value with database information and display the result. I managed to get everything working correctly, but now I am facing a peculiar issue where the drop-down box is ...

In C#, analyze the values in SPItemList to extract only the ones that match

My current code retrieves all Header1Ref values from SharePoint using the SPListItem object. However, I would like to filter the results based on matching values from an array instead of retrieving all. Can anyone help me figure out how to achieve this? ...

Issues with displaying Bootstrap 5 second toast notifications

Hey there, I'm facing an issue with getting the second toast to display properly. Here is the HTML: <div class="toast-container position-fixed bottom-0 end-0 p-3"> <!-- FIRST --> <div class="toast" role="aler ...

Break down the string and iterate through using AngularJS

When looking at a string in the format "Something for example $takeThis $takeThisAlso", I need to parse it and extract all substrings that are enclosed within $ ($xxx). This means I want to achieve something like this: foreach($xxx in list) { var field ...