Firstly you can go to your site and right click and inspect. You can see where the spacing is coming from by hovering over the html elements. The spacing comes from the div class="container"></div>. It has a margin set which is distance away from the element, you will see it represented as orange in devtools.
The following style is being applied.
.container {
--distance-to-bleed: max(var(--container-gutter), 50% - var(--container-max-width) / 2);
margin-inline-start: max(var(--container-gutter),50% - var(--container-max-width) / 2);
margin-inline-end: max(var(--container-gutter),50% - var(--container-max-width) / 2);
}
Now you can remove the !important declaration here. This is totally a wrong use case for it and bad css practice. The style is applied without it anyways.
I personally would’ve changed the structure of the product page to make it cleaner and just use css flex box but if you want a quick fix, the design breaks at 1000px for desktop.
That means you can write the media query and these styles will be applied only above 1000px, which is where the mobile design ends and the desktop layout begins.
@media (width >= 1000px) {
.container {
margin-left: 0;
}
}
I would also note that if you check your collection page, there is another bad selector and you are getting a horizontal scroll.
@media screen and (max-width: 699px) {
.product-list:not(.product-list--carousel) {
margin-inline: -.625rem;
}
}
This is in the theme.css file and what the css rule is doing is pulling the inline margin 10px to the left and 10px to the right essentially stretching it. This is also being applied to an element with a display of grid which is absolutely pointless and a wrong use of code. The reason the horizontal scroll is there is because the grid has been stretched past the width of the viewport. Looking further up the chain there is another rule, max-width: 100%; this is another false use case, the developer that did this tried to constrain the width of the grid to the viewport, albeit wrongly and then stretched a subgrid with the negative margin. This is also a hack that doesn’t need to be used as it leads to weird css bugs.
Lastly when I look at the max-width: 100%; and margin: 0; there is the !important declaration again twice. This is absolutely a huge no no. There is also a css selector “@media screen and (max-width: 699px) {}”, this is another small mistake, it isn’t important and the code still works but anytime you want to target a certain viewport width, you don’t need to specify “screen”. “@media (max-width: 699px) {}” is the correct usage.