Images are not appearing correctly on Chrome browsers when using Windows operating system

img tags seem to have unusual margins in Chrome, Edge, and Opera browsers, while Firefox displays them correctly.

Queries

  1. What is causing these margins specifically in Chrome? The Devtool does not detect any margin properties.
  2. Is there a straightforward solution to fix this issue?

Code Illustration

Access the Code Pen Link for further details: https://codepen.io/silwalanish/pen/vYjYVbL

.container {
  gap: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}

.card {
  border: 2px solid;
}

.thumbnail {
  width: 100%;
  height: 400px;
}

img {
  width: 100%;
  height: 100%;
}
<div class="container">
  <div class="card">
    <div class="thumbnail">
      <img src="https://images.unsplash.com/photo-1655427565427-34ea63c7ede6?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY2MjE4OTQ4Ng&ixlib=rb-1.2.1&q=80&w=1080" alt="Test Image">
    </div>
    <p>Asdasdasd</p>
  </div>
  <div class="card">
    <div class="thumbnail">
      <img src="https://images.unsplash.com/photo-1655427565427-34ea63c7ede6?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY2MjE4OTQ4Ng&ixlib=rb-1.2.1&q=80&w=1080" alt="Test Image">
    </div>
  </div>
  <div class="card">
    <div class="thumbnail">
      <img src="https://images.unsplash.com/photo-1655427565427-34ea63c7ede6?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxfD ...

Snapshot

Chrome

https://i.stack.imgur.com/E4Ew4.png

The left and top margins around the images are noticeable in Chrome.

https://i.stack.imgur.com/9I2mV.png

If you resize the page, you will see odd margins appearing on the right (middle image).

Firefox

https://i.stack.imgur.com/qIhoi.jpg

Edit

This issue seems to be particular to Windows operating systems. It functions correctly on Linux and reportedly works well on Mac according to one of the comments.

No unexpected margins are observed in Firefox on any platform.

Answer №1

Consider removing the default margin and padding from the body of your webpage. Certain browsers automatically include these settings, which can affect the overall layout. Try adding the following CSS code to address this issue:
body{ margin:0; padding: 0; }

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

"Struggling with setting the default checked state for single and multiple checkboxes? The ng-init method with checkboxModel.value=true seems to be ineffective – any suggestions

<input type="checkbox" ng-model="isChecked.value" ng-true-value="'yes'" ng-false-value="'no'" ng-click='handleCheckboxChange(isChecked.value, idx);' ng-init="isChecked.value=true" /> ...

Can you identify the method used to apply CSS classes to an element?

Looking for clarification, I've noticed a pattern of "adding" (although unsure if that's the correct term) classes to elements in HTML UI frameworks. For instance, considering an element with these class attributes: class="mif-earth mif-2x" To ...

How can I retrieve an attribute from another model in Ember using the current handlebar in the HTML file?

I'm attempting to achieve the following: {{#if model.user.isAdmin}} <div> My name is {{model.user.name}} </div> {{/if}} within a handlebar that is being used in a controller unrelated to users: <script type="text/x-handlebars" data- ...

What Makes Bracket Notation Essential in HTML5?

I recently came across an interesting discussion on the Code Review StackExchange site about best practices for creating forms with multiple rows of identical form inputs. Joseph Silber suggested using bracket notation and avoiding IDs altogether in this s ...

Encountering some difficulties while setting up my development tool (specifically webpack)

I have embarked on a journey to learn modern JavaScript with the help of Webpack and Babel. As a beginner in this field, my instructor is guiding me through the principles of modern JavaScript by building an app called Forkify - a recipe application. While ...

What causes the width of unrelated cells to change when the contents of colspan'd cells expand in IE7?

Before we delve into the details, I invite you to take a look at this fiddle using IE7. It's quite intricate and not something I want to repeat here. The main issue is that clicking on the red block should display additional information. The top row ...

Troubleshooting: How can I ensure my custom scrollbar updates when jQuery niceselect expands?

I am currently utilizing the jquery plugins mCustomScrollbar and niceselect. However, I have encountered an issue when expanding the niceselect dropdown by clicking on it - the mCustomScrollbar does not update accordingly. I suspect this is due to the abso ...

Change the input field to uppercase using JavaScript but do not use inline JavaScript

Hey there! I have a basic script set up (see below) with an input field allowing users to enter a query. This query is then sent to a socrata webservice to request specific data, which is displayed in an alert box. So far, everything works smoothly. var l ...

Form submission using Jquery not functioning properly in Firefox

Having an issue with the .post() function not working on Firefox, but functioning fine on Chrome. This is the code I am using: function saveD() { frm = $('#saveDetailsForm'); $.post(frm.attr('action'), frm.serialize(), fun ...

Incorporating Bootstrap Content: A Guide to Including a PHP File within Another PHP File

I am encountering an issue when trying to import a PHP file containing my navigation bar into another PHP file. Here's the code for the navigation file: <?php echo " <html> <head> <nav class = "navbar navbar-default navbar-fixed-top ...

Creating a Select component in React without relying on the Material-UI library involves customizing a dropdown

Is there a way to achieve a material UI style Select component without using the material UI library in my project? I'm interested in moving the label to the top left corner when the Select is focused. export default function App({...props}) { retu ...

Monitoring user logins based on user identification

How can I effectively monitor the activity of users who have logged into a web application that is managed by an external company? Despite my extensive research efforts, as a non-technical individual, I am struggling to understand how to utilize Google Ana ...

What is the best way to incorporate an input bar in a Bootstrap panel header?

When designing a search box in my panel header, I floated both elements to get them onto the same line. Although functional, the vertical alignment of the title is displeasing and I am seeking a way to improve this without drastically changing its size. I ...

Having trouble generating a WebGL context. Three js compatible with Chrome?

I encountered this error: Error creating WebGL context. Uncaught TypeError: Cannot read property 'getExtension' of null The issue is occurring on Google Chrome version 71. Strangely, when I open the developer tool and refresh the page, it works ...

Disabling the @import cache feature in LessCSS Assetic

I'm facing a minor issue that is robbing me of precious time. Currently, I am using the assetic plugin with the lesscss filter in my symfony2.1 project. The problem lies in Assetic not detecting changes in imported files when using the @import functi ...

Is there a way to trigger both the link and the div element simultaneously?

Is there a way to make both the button and the link light up simultaneously when hovering over the div element, instead of just the button lighting up first? <div id="b1"; class = b> <a href="test.html">BUY</a> < ...

"Selenium WebDriver Unapologetically Delivers Inaccurate Height Measurements for Web

I am attempting to capture a snapshot of a WebElement with the selector .//*[@id='aplus']/div using Selenium Firefox's WebDriver while browsing this specific page: Upon inspecting the element in Chrome, I noted its dimensions as 979.2 by 19 ...

It's possible for anyone to enhance the appearance of the Download button by adding styles without compromising its functionality

Looking to enhance the style of the Download button as it appears too formal. Seeking assistance in adding some button styles to make it more stylish. The code is correct, just aiming to give the Download button a trendy look with specified styles. ...

Implementing the switchClass function on a parent class when hovering over a child class, while ensuring that only the specific divs are targeted and not others with the

Currently using the .switchClass function on both the .container divs whenever I hover, causing all child1 elements within these containers to change from 100% width to 40% width. However, I only want this switch to occur on the specific container that I&a ...

Conceal the overflow from absolutely positioned elements

I've gone through all the similar examples but still struggling to find the correct solution. My issue involves a basic Side Menu that toggles upon button click. Within the menu, there is a list of checkboxes positioned absolutely with the parent con ...