Menu in Header has wrong height
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
Steps to reproduce
Use <Menu />
in <Layout.Header />
component to create basic header navbar
What is expected?
Ant components that are commonly used together should be working together nicely out of the box
What is actually happening?
When you use <Menu />
in <Layout.Header />
, it does’t work out of the box. Menu has lower height that Header thus its not vertically aligned
Environment | Info |
---|---|
antd | 3.13.1 |
React | 16.7 |
System | MacOS |
Browser | Chrome |
Easiest solution would be to write custom menu styles in the layout styles. However from what I have seen, you dont mix styles between components like this.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:9 (8 by maintainers)
Top Results From Across the Web
Menu and Header height gone wrong - Support | Kriesi.at - Premium ...
Hello,. I have just noticed an issue with my home page menu on IE and in all browsers when screen width is between...
Read more >Vertically center menu within variable height header
I have a header that may or may not contain an image/logo and whose size is variable. I'd like to vertically align my...
Read more >Header height overflowing with widget - WordPress.org
I had tried every setting, once I change In the header Primary Menu option widget to other none or search. The header height...
Read more >menu item height - changes mobile header height
If I set the – menu item height – so the menu is OK then the header is too small and if I...
Read more >How to reduce the height of the Secondary Header Bar to only ...
1. Please send your website url so that we can provide a possible css for the secondary header height. 2. Please head to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This should be fixed. It is a terrible ‘first experience’ for this framework. One of the first things I do when building a website is put together the header and nav. Putting a
<Menu
in the<Layout.Header
is one of the very first things most people will do (IMO).When it does not work correctly, the first time, people will think the whole framework is busted and nothing works well together. It will sour their opinion of how this framework was built. God forbid they actually find this github issue and think that adding a
style={{ lineHeight
into their code is a good idea at all. In fact, I believe people using AntD are trying NOT to customize and put hard coded styling into their application at all. This will decouple the ‘header’ from the theme, which removes any ability to easily change the header height later. Changing this@layout-header-height
will no longer properly change the header height.Look at this issue here: https://github.com/ant-design/ant-design/issues/15744 ^ The person abandoned the framework after realizing they could not even put a NavBar together without customizing styles directly on the component level.
I think AntD should:
@layout-header-height
variable when rendered within aLayout.Header
. ORNavBar
component to the library so people can get around this issue.I see. Since you don’t want to set the
style
in theHeader
, you can set thestyle
inmenu.item
.