New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: MenuItem with icon only will still have additional margin #21925
Conversation
@@ -203,6 +203,16 @@ | |||
margin-left: 10px; | |||
} | |||
} | |||
|
|||
&.@{menu-prefix-cls}-item-only-child { | |||
.@{iconfont-css-prefix} { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
能不能用 .@{iconfont-css-prefix}:only-child
伪类?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
css selector can not handle text node. Add additional className for check if only one child.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:last-child
:only-child
都试过了,text node 都选不出来。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为啥需要选 text node,不是 icon 么。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为你只选择了 mail 的图标……试试下面这个:
- .anticon.anticon-mail:only-child {
+ .anticon:only-child {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.ant-menu-item > .anticon:only-child {
margin-right: 0;
}
这样如何
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
外层 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 |
fix #21917
css selector can not handle text node. Add additional className for check if only one child.