How to change max-width in the product gallery in Magento 2 by using below code.

<div class="fotorama__stage__shaft fotorama__grab" tabindex="0" data-gallery-role="stage-shaft" style="width: 684px; margin-left: 0px; transition-duration: 0ms; transform: translate3d(0px, 0px, 0px); max-width: 572px;"

Any advice?


Look at this file:


Line: 1900

Or find this line:

$stageShaft.css('max-width', $wrap.width() - padding);

This is the file that builds the gallery on product page.


You have to override view.xml from blank theme in your custom theme under etc folder and now you can change product image's width according to your need.I hope it will help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.