简体   繁体   English

字体大小增加导致ul菜单未对齐

[英]Increased font-size causes ul menu to be misaligned

As demonstrated here , I've built a fixed menu using unordered lists and a lot of css. 这表现在这里 ,我已经建立了使用无序列表和大量的CSS的固定菜单。 I've also included a button with a custom class that redirects back to the frontpage and made it a litter bigger using font-size: 130%. 我还包括了一个带有自定义类的按钮,该按钮可重定向回首页,并使用font-size:130%使它变得更大。 By using line-height: 0; 通过使用line-height:0; I was able to force all buttons to be the same height. 我能够将所有按钮强制设置为相同的高度。 Unfortunately, somehow an extra pixel of height is added to the menu and the big button sticks to the top, while the rest of the buttons stick to the bottom. 不幸的是,以某种方式将额外的高度像素添加到菜单中,大按钮停留在顶部,而其余按钮停留在底部。 Apart from seriously triggering OCD, it looks plain ugly when hovering, so I'd like to fix it. 除了严重触发OCD之外,它在悬停时看上去也很丑陋,因此我想对其进行修复。 I am at a dead end and cannot solve this by myself, so I would like to ask anyone to help me out. 我处于死胡同,无法独自解决这个问题,所以我想请任何人帮助我。

Thanks in advance! 提前致谢!

li.menu-titel {
    font-size: 130%;
    font-weight: lighter;
    overflow:hidden;
    line-height: 0;
}

Simple format all your li with display:inline-block (instead of inline ), 使用display:inline-block (而不是inline )对所有li进行简单格式化,

or remove the vertical-align:top; 删除vertical-align:top; .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM