尝试制作我的第一个网站草稿,但我注意到左边距问题。我尝试从样式表中删除所有导航属性和类,但左边距仍然较大。任何帮助表示赞赏,谢谢。我还是这个论坛的新手,所以如果我的格式有问题,请纠正我。 (在整页中查看片段/代码以查看左边距问题)
html {
background: url("Images/char2.jpg") fixed no-repeat;
background-size: 100%;
background-size: cover;
color: white;
overflow-x: hidden;
}
* {
box-sizing: border-box;
padding: 0px;
margin: 0px;
}
.bg-opacity {
background-color: rgba(0, 0, 0, 0.8);
}
h1 {
font-family: courier;
text-align: center;
font-size: 300%;
padding-top: 30px;
padding-bottom: 30px;
}
h1 a {
text-decoration: none;
color: white;
animation: party-header 0.5s infinite alternate;
}
@keyframes party-header {
0% {text-shadow: 0px 3px 3px gray, 0px -3px 3px gray, 3px 0px 3px gray, -3px 0px 3px gray;}
100% {text-shadow: 0px 3px 3px gold, 0px -3px 3px gold, 3px 0px 3px gold, -3px 0px 3px gold;}
}
.navflexcontainer {
display: flex;
justify-content: space-around;
align-items: center;
width: 100%;
text-align: center;
flex-wrap: wrap;
flex-direction: row;
}
.navflexcontainer li {
list-style-type: none;
padding-top: 10px;
padding-bottom: 10px;
text-align: center;
}
nav ul li a{
text-decoration: none;
color: white;
padding: 11px;
font-family: "times";
font-size: 23px;
text-shadow: 0px 2px 3px yellow;
text-align: center;
}
nav ul li a:hover {
color: yellow;
text-shadow: 0px 2px 8px white, 0px -2px 8px white;
}
<!DOCTYPE HTML5>
<html>
<head>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body class="bg-opacity">
<h1><a href="#">VIP Black Market<a></h1>
<div>
<nav>
<ul class="navflexcontainer">
<li><a href="#" class="active">Home</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Cryptocurrency</a></li>
<li><a href="#">Loan</a></li>
<li><a href="#">About Us</a></li>
</ul>
</nav>
</div>
</body>
</html>
答案 0 :(得分:0)
关闭 a
中的 h1
标签。它导致浏览器创建破坏 UI 的空片段