I just want to know what is the best practice about css in Magento2. We have the possibility to have design in Vendor_Name/MyModule/view/frontend/web/css and we can also put the design in : app/design/frontend/Vendor_Name/default/web/css so my question is when do we have to put design in the module and when do we have to put it in the theme ?

Thanks for your help.


Conventionally, CSS and LESS files are stored only in themes. Module directories do not contain any default styles.

Technically there is an option to include them in template files, but i strongly recommend avoiding this.

Stylesheets are stored in this location:


For more details see Magento developer documentation enter link description here


Put CSS in the theme is the best practice.

Because if you need to create the mobile-specific theme then it would be helpful to identify your device specific CSS using the theme. It also helps to boost page speed performance.

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.