我做了一個總是在底部頁腳與codepen此代碼。總是在底部頁腳不工作
HTML
<div class="content">
<header>
<p>blabla</p>
</header>
<main>
<p>blaBlabla blub</p>
</main>
</div>
<footer>
<p>more bla</p>
</footer>
CSS
*{
margin: 0;
padding: 0;
border: 0;
}
html{
height: 100%;
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
position: relative;
margin: 0;
padding-bottom: 250px;
min-height: 100%;
background-color: white;
}
.content {
margin: 0 auto;
width: 100%;
}
footer {
position: absolute;
right: 0;
bottom: 0;
left: 0;
background-color: black;
color: white;
text-align: center;
}
當我打電話的頁面與「文件,它工作正常:/// C:/ XAMPP/htdocs中/文件夾/ index.html「,但是當我用」http://localhost/folder/index.html「調用它時,它不會。我希望有人能幫助我,因爲我真的感到沮喪。
你能分享codepen嗎? – Jase
你可能還沒有使用你的CSS的相對文件路徑。 – Faegy
在瀏覽器中打開index.html文件後,點擊右鍵,選擇查看源代碼。在查看源代碼時,請檢查與index.html鏈接的css文件是否正確。 –