【问题标题】:My HTML is rusty but I'm pretty sure something is wrong我的 HTML 生锈了,但我很确定出了点问题
【发布时间】:2013-09-23 15:32:01
【问题描述】:

所以在离开 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

感谢任何帮助,因为这让我发疯了!

【问题讨论】:

    标签: html margin


    【解决方案1】:
    html,body{margin:0}
    

    问题解决了。

    【讨论】:

    • 哇,我记得以前很挣扎,感觉就像用木槌敲自己一样……非常感谢!回到木槌板。
    猜你喜欢
    • 2012-07-29
    • 2012-04-19
    • 2012-06-19
    • 2023-03-27
    • 2016-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-26
    相关资源
    最近更新 更多