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

React - Highcharts Full Screen dark overlay

I am currently working on integrating highcharts/highstock into my application, and I have encountered an issue with the full screen functionality. The challenge I am facing is setting a fixed height for my charts while also enabling the option to view ea ...

Press the button to access the URL within the current window

Working with Angular, I attempted to develop a function to open a URL in the current window. However, the code below within the controller actually opens a new window: $scope.openUrl = function(url) { $window.open(url); }; ...when using ng-click=&apo ...

"Challenges in styling a table within a div: the text fails to adhere to the

I am struggling to identify the source of a problem in my code. The issue seems to be related to the padding within the parent div, specifically with the text "1 Healthy Midday Meal for One Child Overseas" and how it is ignoring the 5px right padding. Upon ...

Selenium: Firefox displaying unique behavior when initiated by Selenium webdriver

Note - Application developed using ExtJS framework. Certain elements or parts of elements in ExtJS, such as titles, are not displaying or loading correctly when accessed through Selenium launched Firefox. Steps taken to troubleshoot: Manually accessing ...

Creating Eye-Catching Images by Incorporating Image Overlays Using Just One Image

I'm facing a bit of a challenge here. I need to figure out how to overlay an image onto another image using just a single image tag. Specifically, I want to add a resize icon to the bottom right corner of an image to let users know they can resize it ...

How can I create an HTML select dropdown menu with a maximum height of 100% and a dynamic size?

The dropdown menu I created using an HTML select tag contains a total of 152 options. However, the large number of options causes some of them to be out of view on most monitors when the size is set to 152. I attempted to limit the number of displayed opti ...

In Laravel, the text-overflow:ellipsis property fails to function properly when trying to display unescaped data

Encountering an issue with the property text-overflow:ellipsis. The ellipsis at the end of the truncated text is not showing up as expected. To maintain formatting without escaping data in ckeditor, I am using: {!! $treatment->description !!} speci ...

Utilize a fresh font style and replace the font family components in @mui/material with the new

Looking to bring in a fresh font family stored in a fonts directory and replace the existing mui base font family. import { responsiveFontSizes, createTheme } from '@mui/material'; import NEWFONTFAMILLY from '../fonts/something.otf' c ...

Encountered a WebDriverException when using Selenium Python with ChromeDriver. The service for /usr/bin/google-chrome unexpectedly exited with a status code of -11

While attempting to execute webdriver in a Python script, I encountered an issue where the script exits with status code 11 when trying to run Google Chrome. Below is the Python script in question: #!/usr/bin/python3 import time from selenium import web ...

Conceal anchor links using jQuery by targeting their title attribute

Looking at the html below <li class="static"> <a title="blog" class="static menu-item" href="http://google.com">Blog</a> </li> <li class="static"> <a title="profile" class="static menu-item" href="http://profile.com"> ...

Browser comparison: Chrome and Firefox - peculiar ID name causing table width difference without CSS. Suspected AdBlocking interference

There seems to be an issue with a table I have in Chrome. Whenever I change the ID name, it either sets the width to zero or doesn't display at all. You can view it here: http://jsfiddle.net/kdubs/W6GTE/ The specific line causing trouble is: <ta ...

Struggling to accurately capture the values from checkboxes and dropdown selections to ensure the correct data is displayed. Assistance is needed in this

I am facing challenges in retrieving the accurate data for display from Mat-Select and Mat-Checkbox components. My goal is to capture the selected values from users and perform if-else statements to validate conditions, displaying the correct data view if ...

ReactJS is unable to locate a valid DOM element within the target container

I recently embarked on my journey to learn ReactJS and I celebrated successfully writing my first code. However, when I encountered the same pattern with components, an error popped up stating _Invariant Violation: registerComponent(...): Target container ...

Overlap bug with Flash content

In both Google Chrome (16.0.912.75 m) and Safari (5.1.1), I am encountering the well-known flash / html overlay issue. Despite setting the wmode attribute to transparent as suggested here and here, along with trying opaque, the problem persists. Following ...

Font Awesome solely alters the font size within html, rather than css

<i class="fa fa-graduation-cap" aria-hidden="true" style="font-size: 50px;"></i> It's functioning properly. .fa-graduation-cap { margin-top: 38px; color: #E46A6B; font-size: 50px; } Not working too well. This issue is new to me. Any th ...

Hide table cells using jQuery if they do not contain a specific content

Is there a way to conceal the td elements in a table that do not have the inline CSS attribute width:12%;? See code example below. <td class="" id=""> <td class="" id=""> <td class="" id=""> <td width="12%" class="" id=""><!-- ...

Master the art of displaying complete text when zooming in and elegantly truncating it when zooming out

I am currently working on a data visualization project using d3.js. The tree chart that I have created is functioning well, but I would like the text to react dynamically when zooming in and out. You can find the code for my project on this JSFiddle page. ...

"Utilize Ajax to load PHP content and dynamically refresh a specific div

I have implemented an image uploading system, but now I want to incorporate a feature that allows users to rotate the uploaded images using Ajax. The challenge I'm facing is that if the session variable is lost during a full page update, I need to ens ...

Height of CSS border-top

I'm facing an issue with setting the height of my top border. It seems like a traditional solution is not possible based on what I have read so far. However, I am determined to find a workaround for this problem. My goal is to have the border align at ...

React Application - The division is positioned centrally when run on local host, however, it does not retain its center alignment

I'm encountering an issue with deploying my create-react-app on github pages. The first image showcases my deployed app on github pages, but the image is not properly centered on the page as intended. https://i.stack.imgur.com/rOciT.jpg On the othe ...