fix: MenuItem with icon only will still have additional margin#21925
fix: MenuItem with icon only will still have additional margin#21925
Conversation
| } | ||
|
|
||
| &.@{menu-prefix-cls}-item-only-child { | ||
| .@{iconfont-css-prefix} { |
There was a problem hiding this comment.
能不能用 .@{iconfont-css-prefix}:only-child 伪类?
There was a problem hiding this comment.
css selector can not handle text node. Add additional className for check if only one child.
There was a problem hiding this comment.
:last-child :only-child 都试过了,text node 都选不出来。
There was a problem hiding this comment.
为啥需要选 text node,不是 icon 么。
There was a problem hiding this comment.
因为你只选择了 mail 的图标……试试下面这个:
- .anticon.anticon-mail:only-child {
+ .anticon:only-child {There was a problem hiding this comment.
.ant-menu-item > .anticon:only-child {
margin-right: 0;
}这样如何
There was a problem hiding this comment.
外层 selector 是没用的, text node 是选不到的。
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 17e831d:
|
Codecov Report
@@ Coverage Diff @@
## master #21925 +/- ##
=======================================
Coverage 97.96% 97.96%
=======================================
Files 305 305
Lines 7015 7015
Branches 1933 1934 +1
=======================================
Hits 6872 6872
Misses 143 143
Continue to review full report at Codecov.
|
|
close #21984 too |


🤔 This is a ...
🔗 Related issue link
fix #21917
💡 Background and solution
css selector can not handle text node. Add additional className for check if only one child.
📝 Changelog
☑️ Self Check before Merge