html - 我无法删除标题上方的空白区域
问题描述
margin-top: 0
,padding
而其他事情无助于删除我的标题上方的空白空间。
header {
width: 100%;
height: 60px;
background-color: black;
font-family: calibri sans-serif;
font-size: 20px;
color: white;
position: relative;
}
html,
body {
margin: 0;
padding: 0;
}
.headerlist li {
list-style: none;
float: left;
padding: 15px;
}
.headerlist li>a:link {
color: white;
text-decoration: none;
}
<body>
<header>
<ul class="headerlist">
there was some li lines
</ul>
</header>
</body>
我预计标题上方没有空白区域,但它就在那里。
解决方案
添加margin:0
到您的ul
元素(它具有默认边距值)
header {
width: 100%;
height: 60px;
background-color: black;
font-family: calibri sans-serif;
font-size: 20px;
color: white;
position: relative;
}
html,
body,
ul {
margin: 0;
padding: 0;
}
.headerlist li {
list-style: none;
float: left;
padding: 15px;
}
.headerlist li>a:link {
color: white;
text-decoration: none;
}
<body>
<header>
<ul class="headerlist">
there was some li lines
</ul>
</header>
</body>
推荐阅读
- rust - 设置文本轮廓颜色
- oop - 评估上下文中 this/self 的命名约定
- python - 如何将函数的结果从一个文件传递到另一个文件
- excel - Excel VBA:在是/否下拉菜单上显示/隐藏图片;同时进行故障排除。可见吗?
- python - 使用函数清除从不同函数创建的 Tkinter 图像
- css - 如何从引导程序中否决!重要的 css 规则
- excel - 如何在 laravel 中创建动态模型?
- javascript - 使用 google-sheets api 显示用户请求的列,用于 JavaScript 中的 Discord Bot
- python - 姜戈。生产中的调试
- ios - 当 if 语句返回 true 时停止执行函数