问题描述
我遇到了最奇怪的问题...
我遇到了问题,我的网站内容扩展到很大。我的意思是,我有一个水平滚动条。我真的不知道为什么我检查了我的CSS代码的每一行以及HTML。但是问题仍然存在。
我希望有人无聊可以在这里帮助我...
我将网站上传到netlify:https://usov.netlify.app/
HTML
<!Doctype HTML>
<html>
<head>
<title>UniqueSurvival</title>
<Meta charset="utf-8">
<Meta name="viewport" content="width=devicewidth,initial-scale=1.0">
<link href="css/style.css" rel="stylesheet" type="text/css">
<link href="css/style.css" rel="stylesheet" type="text/css">
<link href="css/gallery.css" rel="stylesheet" type="text/css">
<script src="https://kit.fontawesome.com/1908996dcd.js" crossorigin="anonymous"></script>
<link rel="icon" href="">
</head>
<body>
<div id="page-container">
<div id="main-nav">
<nav>
<a href="https://docs.uniquesurvival.net/" target="_blank"><i class="fas fa-book"></i> Wiki</a>
</nav>
</div>
<div id="content-wrap">
<p id="headline">Unique Survival</p>
<div id="content-content">
lorem ipsum dolor sit amet
</div>
</div> <!--schließt content wrap-->
<footer id="footer">
</footer>
</div> <!--schließt page container-->
</body>
</html>
CSS:
@charset "utf-8";
@import url('https://fonts.googleapis.com/css2?family=Varela+Round&display=swap');
:root{
font-family: "Varela Round";
font-size: 1.1rem;
background: rgba(37,37,38);
background-image:
linear-gradient(to bottom,rgba(245,246,252,0),rgba(37,38)),url('/pics/bg.jpg');
width: auto;
height: 114.2%;
background-size: cover;
background-repeat: no-repeat;
color: white;
}
div#page-container{
}
div#main-nav{
z-index: 0;
font-family: "Varela Round";
font-size: 1.5rem;
position: relative;
left: 20%;
top: 10px;
}
div#main-nav a{
text-decoration: none;
}
div#main-nav a:link{
transition: 0.5s;
color: rgb(158,158,158);
}
div#main-nav a:visited {
transition: 0.5s;
color: rgb(158,158);
}
div#main-nav a:hover {
transition: 0.5s;
color: rgb(175,255,144);
}
div#content-wrap{
width: 60%;
position: relative;
left: 20%;
top: 0;
text-align: justify;
}
p#headline{
position: relative;
top: 0;
text-align: center;
width: 99%;
font-size: 6rem;
letter-spacing: 0.5rem;
background: -webkit-linear-gradient(#ffffff,rgba(66,66,0));
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
}
div#content-content{
background-color: rgb(32,32,32);
position: relative;
}
解决方法
删除“位置:相对;”或添加“最大宽度:80%;”
div#main-nav {
z-index: 0;
font-family: "Varela Round";
font-size: 1.5rem;
left: 20%;
top: 10px;
}
,
在max-width: 80%
下添加div#main-nav
。
left:20%
正在将导航20%推出屏幕。