html - 删除 HTML 文档中的边框间隙
问题描述
我正在学习 HTML,并且我创建了一个带有标题栏的非常简单的页面,但是由于某种原因,标题与页面的侧面和顶部之间存在间隙,如下图所示:
有没有办法删除这个?代码:`<!doctype html>
<style>
html {
background: url('background.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
ul {
list-style-type: none;
margin: 0;
padding-top: 10px;
padding-left: 800px;
overflow: hidden;
background-color: rgba(0,0,0,.3);
}
li {
float: left;
}
li a {
display: block;
color: grey;
text-align: center;
padding: 14px 24px;
text-decoration: none;
font-size: 20px;
font-weight: lighter;
font-family: "Century Gothic", CenturyGothic, Geneva, AppleGothic, sans-serif;
}
/* Change the link color to #111 (black) on hover */
li a:hover {
background-color: #111;
}
</style>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<ul>
<li><a href="default">Home</a></li>
<li><a href="portfolio">Portfolio</a></li>
<li><a href="contact">Contact</a></li>
</ul>
`
解决方案
将此添加到您的 CSS
*{
margin: 0;
padding: 0
}
推荐阅读
- java - 框架隐藏在主框架下
- kubernetes - kubernetes - 将容器信息公开为环境变量
- java - 如何在滚动视图的第二个活动顶部实施 admob 横幅广告?
- android - HttpsURLConnection 不适用于 API 28 Android 9
- handlebars.js - 在 Handlebars 中使用带有多个变量的“#each”
- r - 如何根据两列中的任何一列中的重复值生成唯一 ID?
- gem5 - gem5 是否实现了 clflush?
- shiny - 如何允许 Shiny-App 仅从一个特定的 Dropbox 文件夹上传/下载数据?
- python-2.7 - 如何在 Python 中输出
- javascript - 当前时间的日出日落时间图像与javascript