How to override the style of `item` in `el-dropdown- menu`

question 1: when using ele.me dropdown-menu component, how can the style of item be overridden?

my current state is like this (the last item is not router-link , so the style is different from the previous one):

clipboard.png

the result I want:

  • Link color becomes black
  • border becomes none

I tried to set color and border in .el-dropdrown-item , but it didn"t work.

question 2: how to solve this problem through the source code?

I have often encountered this problem before. I have tried several times to find out what the style and name of a component is in the source code, but in the end, I can"t find it. I still see the style of some of the attributes shown on the right when I look at element in F12.

but when I use components that can"t see styles in element (such as dropdown-menu-item ), how can I override them with source code?

Oct.28,2021

/ deep/ .el-dropdrown-item {} overwrite your css like this try


add! importan to the css style you wrote, it is also possible that you introduced the css style of ele.me frame after you wrote it. Cause the style you wrote to be washed out


if the rest of your project is not affected, you can write directly in the global, if so, you can package a class in the outermost layer, and then write the element style you want to overwrite. If you can find the parent of the element, you can also use / deep/, if you use Vue, do not write in scoped, because it does not work

Menu