What could be causing the CSS grid to be showing up in incorrect pixel dimensions?

As someone new to CSS Grid, I am encountering a problem where the boxes are appearing in the correct positions but with incorrect pixel sizes. The main container is showing up at around 1500px instead of the intended 1200px, and all the row dimensions seem to be off as well.

#container {
  width: 1200px;
  display: grid;
  grid-gap: 10px;
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-rows: 225px 175px 225px 160px;
}

.feature {
  grid-row: 1 / 5;
}

.vertical {
  grid-row-end: span 2;
}

.im_picture {
  background-color: #336;
}

.im_picture img {}

.button {
  background-color: #808000;
  grid-column: 2 / 4;
}
<div id="container">
  <div class="im_picture feature"></div>
  <div class="im_picture vertical"></div>
  <div class="im_picture"></div>
  <div class="im_picture vertical"></div>
  <div class="im_picture"></div>
  <div class="button">book a session</div>

Answer №1

The code itself is fine; the problem lies in the interaction between Chrome and certain Windows settings causing issues.

For more information on adjusting UI scaling for Chrome, check out this link:

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

Tips for Creating a Responsive Homepage

I'm new to CSS and trying to create a responsive design for mobile IE. Currently, the page appears blank on IE but works fine on Google Chrome and other browsers :-) Here are the code snippets I have used: HTML: <div class="main"> <div ...

Tips for turning cards in HTML

I am a beginner in web development and encountering a specific issue. To address this, I have created a Codepen My challenge involves implementing images for the 6 cards displayed. Upon hovering over an image, it should transition to show the content of t ...

Beneath the footer lies a blank space in white

Visit our site for information on various towns. However, we are facing an issue with the CSS when it comes to new or less populated towns like this one, where the footer is not aligning properly and leaving a large white gap below. We attempted to implem ...

What is the best way to display the panel during a postback?

I have a group with two radio buttons labeled purchase and expenses. When the purchase radio button is clicked, the panelpurchase will be displayed, and similarly, the panelexpense will show for the expenses radio button. Check out the image of the output ...

Incorporate hover and click functionality to the dropdown button using JQuery

Recently, I implemented hover and click events to trigger the opening of a dropdown content The functionality is mostly working as expected but there is a slight issue When hovering over the element, the content opens and closes properly However, on the ...

Incorporating various videos into product listings

In my current school project, we are required to create a webshop using a database containing product details. The majority of the work is completed in HTML. I would like to incorporate a video for each product on the site, but the code snippet I found onl ...

Bootstrap 5: After tapping on the button, the hue was transformed

I've been using Bootstrap buttons and I decided to change the color of one. However, when I clicked the button, it still changed to blue even though I specified ".btn-primary:active". HTML: <button type="button" class="btn btn-prima ...

What is the reason behind H1 tags not requiring a class or ID in CSS?

As I was reviewing my CSS code, I noticed that the h1 tag is defined like this: h1 { .... } Unlike everything else in my code, which either has an id "#" or a "." class preceding it. This made me wonder why header tags don't require this. Could it b ...

Using jQuery to load the center HTML element

So here's the plan: I wanted to create a simple static website with responsive images that load based on the browser width. I followed some suggestions from this link, but unfortunately, it didn't work for me. I tried all the answers and even a ...

The code will only detect the browser when accessed from a mobile device, and will display a

I've experimented with various methods to make this work. My website has a streaming radio player at the top of the page, usually using the default script provided: <center> <!--Wavestreaming.com SHOUTcast Flash Player--> <scri ...

Get the current temperature by clicking on the "simpleweather

Working on an app using jQuery with the SimpleWeather plugin for HTML5 and Cordova. Looking to overlay a background-image with the temperature. -HTML-HEAD- $(document).ready(function() { $.simpleWeather({ location: '', wo ...

Eliminating the gray background using CSS

How can I remove the gray background that automatically appears in my CSS header? .header { padding: 60px; margin: 20px auto auto auto; width: 1400px; border-radius: 10px; text-align: center; background: # ...

Apply a border to the div that has been selected

I have a tool for storing information and I am using *ngFor to display each instance in a line. Is there a way to add a border when clicking on a line? The border should only appear on the clicked line, disappearing from the previous one if another line i ...

What is the process for calling a class in HTML from a <Div> tag?

I am struggling with the following code snippet: <p class=‘majed’ style="color:#FF0000";>Red paragraph text</p> How can I reference the 'majed' class above? <Div class=‘majed’ > </Div> Your help is greatly appr ...

Switch the view to a grid layout upon clicking

Using bootstrap 5, I've successfully created a list view: <div class="col"> Click to switch to grid/list </div> Below is the content list: <div class="row mt-3 list"> list view ... ..... ....... </div ...

Display images that have been uploaded on the page either as a grid view or a list of

In my Reactjs application, I am uploading multiple images to Azure Blob Storage. On a page, there is a button to open the upload form. Once the upload completes, I want to display all these images on the same page. Since the images have different aspect ...

Custom HTML on Joomla causing carousel to vanish

I've encountered an issue with my Joomla website where my carousel images are disappearing. I have a code snippet from W3 Schools for an automatic banner that works perfectly fine when opened in a browser using Notepad++, but when inserted into a cust ...

Identifying issues in jQuery code - What could be causing this error?

My jQuery code is not responding at all, not even showing an error! I'm not sure why, but here is the jQuery Code I'm using: /* This part is working fine */ $(".add-blog .blog-add-form .add-article .input-group select").on("change", function() ...

Arranging titles on the top of the page in a column format, resembling an index

Has anyone figured out how to make the title of the content stick at the top, one below the other, as the user scrolls? I've been using Bootstrap's Scrollspy, which works fine, but I need a few additional features. You can check out the codepen l ...

What is the method for applying border-corner-radius exclusively to the left side of a button using jquery-ui-1.9.2.custom?

In my HTML code, I have the following: <div id="ot-lang-src"> <button id="rerun"></button> <button id="select">Choose a language</button> <ul id="ui-menu-left"> < ...