1

I am new to magento2 development and have tried every possible senario's but still unable to reproduce the issue why my _theme.less file is not overriding existing styles.I have put my less file inside source folder.

Please find below senario's.

In my parent theme

.header . content have max-width:1280px

In my theme.less file

.header .content have max-width:1100px
3
  • waiting for suggestions from all of you Commented May 9, 2018 at 8:18
  • I am a new Magento 2 developer as well. and I find it the steepest learning curve of any CMS. Why do they have to have such a horrible DX. Just make it like wordpress already. And yes I am still stuck on this exact same thing. Commented May 9, 2018 at 14:53
  • Can anyone have video tutorial uploaded for same css overriding?.it will be a great help for developers like us who are stuck with this thing to overcome. Commented May 10, 2018 at 3:38

2 Answers 2

1

You can override below file :

/lib/web/css/source/lib/variables/_layout.less

In your theme :

/app/design/frontend/Vendor/YourTheme/web/css/source/lib/variables/_layout.less

Changed in line No. 12

@layout__max-width: 1280px;

TO

@layout__max-width: 1100px;
1
  • 1
    working perfect..! Thanks Commented Oct 20, 2020 at 6:03
0

Put an empty file in theme_dir/web/css/source/_theme.less. The blank file will override the _theme.less file. After that run :

php bin/magento cache:clean
php bin/magento cache:flush 
php bin/magento setup:static-content:deploy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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