0

I'm using the Luma theme. I would like to change the padding for the a-tag tag used in the navigation submenu. I can change the backgroundcolor of the items (li) like this,

@navigation-desktop-level0-item__active__color: @navigation-desktop-level0-item__color;,

but not the padding of the a-tag within the li-tag. Can anyone help me?

seb
3,5723 gold badges26 silver badges57 bronze badges
asked Feb 25, 2016 at 15:22

2 Answers 2

2

Use the developer tools of Chrome to identify the CSS you want to change. Using the map files generated, you should be able to use to identify the LESS code causing the problem.

Source maps should be automatically generated when using grunt. Consult the front-end dev docs on how to setup grunt.

There you might either find a configuration variable you just have to change or you have two options:

  1. Copy the .less file to your theme and adapt it
  2. Add own LESS code in your theme with a more specific CSS selector to overwrite the core CSS/LESS.

I currently use option 1. Because it keeps the LESS code more structured. The downside is that it is necessary to copy and maintain core code. I first commit the unmodified copy of the .less file to git, to later track my own changes.

Teja Bhagavan Kollepara
3,8275 gold badges33 silver badges69 bronze badges
answered Jul 3, 2016 at 13:16
1
  • Can you tell him where to put the sourcemap configuration. All that was mentioned on this was to use source map. They need first to be generated. Be sure not to add them to git repository because then production will have them as well. Commented Jul 3, 2016 at 15:26
-1

The way I add styles that are not included in the basic .less files is to add them using regular css.

Add into the header for: magento/app/design/frontend/Company_name/theme_name/Magento_Theme/layout/default.xml

<head>
 <css src="Magento_Theme::css/css_file_name.css"/>
</head>

And then add your styles into the file at: magento/app/design/frontend/Company_name/theme_name/Magento_Theme/web/css_file_name.css

In your case, it could be:

.navigation li.ui-menu-item a {
 padding: 5px;
}
Raphael at Digital Pianism
70.8k37 gold badges192 silver badges357 bronze badges
answered Apr 6, 2016 at 7:09
1
  • But then you give up all the powers of LESS Commented Jul 3, 2016 at 13:11

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.