简体   繁体   English

如何消除 HTML 导航菜单中行内块元素之间的间隙?

[英]How to remove the gap between inline-block elements in an HTML navigation menu?

"I am trying to create a navigation menu for my website using an unordered list. The menu items should appear horizontally, with each item taking up an equal amount of space. However, when I set the display property of the list items to inline-block, there is a small gap between each item. How can I remove this gap and make the items appear next to each other with no space in between? “我正在尝试使用无序列表为我的网站创建一个导航菜单。菜单项应水平显示,每个项目占用相同的空间。但是,当我将列表项的显示属性设置为内联时-块,每个项目之间有一个小间隙。我怎样才能消除这个间隙并使项目彼此相邻出现,中间没有空间?

Instead of setting each li to display: inline-block而不是将每个 li 设置为显示:inline-block

Try setting the entire ul element to display: flex尝试将整个 ul 元素设置为显示:flex

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

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