gpt4 book ai didi

html - 导航 UL/LI 附加空间

转载 作者:行者123 更新时间:2023-11-28 15:33:36 25 4
gpt4 key购买 nike

那是那些日子之一,我不明白为什么我在下面的代码中的每个 LI 标签的左边都有一个空格。如果将鼠标悬停在菜单项上,您就会明白我的意思。

http://jsfiddle.net/midnitesonnet/C2Dub/

<div id="wrapper">
<div id="menu">
<ul>
<li><a href="#!1">Home</a></li>
<li><a href="#!2">Home</a></li>
<li><a href="#!3">Home</a></li>
</ul>
</div>
<div id="content">Content</div>
<div id="footer">Footer</div>
</div>

最佳答案

I can not figure out why I'm getting a space to the left of each of the LI tags

因为你用 display:inline-block 格式化它们- 标签之间有空格。这是基本的“HTML 行为”,两个内联( block )元素之间的任何空白在显示时都被压缩为一个空格字符。

或者 float the LI instead , 或 write them without whitespace between the tags , 意思是 ...</li><li>...

关于html - 导航 UL/LI 附加空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17340255/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com