因此,在离开 HTML 一个月后,我一直过得很艰难,没什么,但是我似乎失去了一些技巧,这让我的 div/任何 html 元素距离顶部不只有几个像素一个页面,即使有一个固定的 div,它仍然距离我页面的顶部和左侧大约 8 个像素,我不知道发生了什么。没有填充,没有边距,没有这样的东西,我完全不明白为什么会这样。
<html>
<head>
<title>
CrystalBallStories
</title>
<link rel=stylesheet link="stylesheet" href="style.css" media="screen">
</head>
<body>
<div id="main">
<nav id="nav">
<div class="nav_opt">
Home
</div>
</nav>
</div>
</body>
</html>
是 HTML 和 CSS 是:
html
{
font-family:Corbel, 'Lucida Grande', Helvetica, sans-serif;
background: rgb(69,72,77); /* Old browsers */
background: -moz-linear-gradient(top, rgba(69,72,77,1) 0%, rgba(0,0,0,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(69,72,77,1)), color-stop(100%,rgba(0,0,0,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(69,72,77,1) 0%,rgba(0,0,0,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(69,72,77,1) 0%,rgba(0,0,0,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(69,72,77,1) 0%,rgba(0,0,0,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(69,72,77,1) 0%,rgba(0,0,0,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#45484d', endColorstr='#000000',GradientType=0 ); /* IE6-9 */
}
::-webkit-scrollbar {
width: 12px;
}
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 10px;
}
::-webkit-scrollbar-thumb {
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
}
#main
{
background-color:#000000;
position:fixed;
height:98%;
width:80%;
color:#DDDDDD;
overflow-y:scroll;
text-wrap:break-word;
margin-left:10%;
margin-right:10%;
border-top-left-radius:30px;
border-top-right-radius:10px;
}
#nav
{
background-color:rgba(69,72,77,0.8);
height:8%;
}
这曾经对我有用,但由于某种原因,正如我之前所说,它离顶部和左边有点远,可以在网站上看到:http ://www.crystallballstories.com
感谢任何帮助,因为这让我发疯!