2014-05-22 28 views
0

我的身體沒有保證金在我的CSS爲8像素保證金但我有:對身體

body {  
    margin: 0 !important; 
    padding: 0 !important; 
} 

爲什麼樣式不被遵守?正在加載CSS文件,我已經檢查過了。

<!DOCTYPE html> 
<html> 
    <head> 
     <link rel="stylesheet" href="/styles.css" /> 
    </head> 
    <body id="page-name"> 
     <div id="drag-overlay"></div> 
     <h1>Title</h1> 
    </body> 
</html> 
+0

什麼是你的HTML代碼? – Gwenc37

+0

已添加到帖子... – panthro

+0

是否css文件路徑很好?你在控制檯中是否有任何錯誤? – Vucko

回答

1

你有沒有試過這種

html, body {  
    margin: 0 !important; 
    padding: 0 !important; 
} 
+1

這是正確的答案嗎?只有'body'有默認的'margin:8px'而不是'html'? – Vucko

+1

等一下,這個解決了嗎?我從來沒有見過這種行爲的瀏覽器,主要是因爲它是錯誤的; html不應該有任何邊距或填充。 以下是Webkit,Firefox和IE的默認CSS:http://trac.webkit.org/browser/trunk/Source/WebCore/css/html.css http://mxr.mozilla.org/mozilla-central /source/layout/style/html.css http://www.iecss.com –

+0

是的,這很奇怪,只有''標籤有默認的邊距設置 - http://www.iecss.com/ –