A product block overflows after changing Hyvä content width. How do you find the local layout conflict?

1 min read

Two silver frames with a blue and violet bar extending beyond the smaller frame

If just one block extends beyond the product page, measure it and its parent. In a local test, the container followed the viewport width while the block kept a minimum width of 960px.

Start with the outer content container

In the target Store View, check the product width and Force width on all pages. When forced width is enabled, version 0.1.30 picks the global value. In the example, the product setting 80% set the width of #maincontent. Hyvä Layout documentation.

Three Opera measurements in rounded CSS pixels
ViewportBlock parentBlock beforeBlock with rule disabled
390312960312
1024819960819
1440115211521152

Find the rule for the affected block

In developer tools, follow the element tree from #maincontent to the nearest container and the block. Compare computed width, min-width and max-width. In the fixture, the local minimum widened the block despite max-width: 100%. Temporarily disabling the minimum made it fit its parent at all three widths. CSS sizing rules.

Change the declaration at its source

Record the selector and the stylesheet or inline style that supplies the rule. Apply your change in the affected block or child theme template. Rebuild the theme stylesheet if the change requires new Tailwind classes. Check the same product and a neighboring block at the same three widths. Hyvä child themes.

Hyvä template modifications for Magento 2 · Configure content width and the product page.

Previous Next

KOWAL.BLOG

Choose your language

Available versions open the corresponding page. More languages are being prepared.

English (UK) Français Deutsch Español Italiano Português Nederlands Svenska Dansk Norsk Suomi Lietuvių Latviešu Eesti Čeština Slovenčina Magyar Română Български Ελληνικά Slovenščina Hrvatski Polski English (US)