css - DIV 内部左侧的奇怪间距求助!

标签 css html spacing

由于某些原因,div 的左侧有一个空格

这是我所看到的照片 http://tinypic.com/r/msc2h/7

CSS

 div {margin:auto;}

    li{padding: 0px; margin: 0px; display: inline; float:left;}

    ul{height: 20px; text-align: left; vertical-align: center; margin: auto;}

HTML

<div style="border: 1px solid white; width: 500px;">
    <ul>
    <li>Home&nbsp;</li>
    <li>Product&nbsp;&nbsp;</li>
    <li>Links&nbsp;&nbsp;</li>
    <li>Contact Us&nbsp;&nbsp;</li>
    <li>Abuot Us</li>
    </ul>
</div>

最佳答案

对于 UL,您也应该将 padding/margin 设置为 0。 Ul 本身有填充。

关于css - DIV 内部左侧的奇怪间距求助!,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5287438/

相关文章:

css - 在 IE 中使用 css 创建子菜单

html - 如何在 Angular 9 中使用 Enter 键触发函数

Jquery 显示/隐藏 div

android - 为什么 drawableStart 的行为与 Android 文档不匹配?

html - CSS 和 HTML : padding, border-spacing 或 border-collapse 在表格上不起作用

email - Outlook 2016 在表格行之间添加了空间。 HTML 电子邮件开发人员,找不到有效的修复程序

css - 控制 LI 元素与其元素符号之间的边距

css - 使用 LESS 自定义样式

css - Codeigniter:无法链接引用的 css 文件

HTML/CSS Tumblr : How to add a new line after each link in Masthead?