我爲網站構建了HTML/CSS頁腳。但是,當我調整屏幕大小時,頁腳不會調整大小,我只能看到剪切頁腳。我希望頁腳div能夠調整大小,以便隨時查看所有文字。任何幫助,將不勝感激。調整調整窗口大小div
/* Footer Style */
#footer-background {
\t position: fixed;
\t height: 30px;
\t left: 0%;
\t bottom: 0%;
\t z-index: 50;
\t width: 100%;
\t background: #000000;
\t opacity: 0.80;
}
#footer-box{
\t width: 95%;
\t margin: auto;
\t padding: 0 10px;
}
#footer-box h2{
\t margin-top: 0;
\t font-size: 20px;
\t text-align: center;
\t line-height: 30px;
\t font-weight: normal;
\t font-family: Arial, sans-serif;
\t color: #A9A9A9;
}
#footer-box a{
\t text-decoration: none;
\t outline: none;
\t color: #A9A9A9;
}
#footer-box a:hover{
\t text-decoration: underline;
}
<!-- Footer bar -->
<div id="footer-background">
\t <div id="footer-box">
\t \t <h2>
\t \t <a href="/abc/">Title 1</a> |
\t \t <a href="/abc/">Title 2</a> |
\t \t <a href="/abc/">Title 3</a> |
\t \t <a href="/abc/">Title 4</a> |
\t \t <a href="/abc/">Title 5</a> |
\t \t <a href="/abc/">Title 6</a> |
\t \t <a href="/abc/">Title 7</a> |
\t \t <a href="/abc/">Title 8</a>
\t \t </h2> \t \t \t
\t </div>
</div>
<!--/ Footer bar -->
您需要刪除的固定高度('高度:30PX;')。這個值不會在文本換行時神奇地調整它自己。 – Turnip
這似乎是調整最新的chrome瀏覽器。這是一個瀏覽器特定的問題? – jfeferman
@turnip - 我將高度從30px修改爲10%,它可以工作。但是頁腳的高度對我來說太高了 - 在底部留下了很多空白。然後我將其設置爲5%,但這不適用於調整大小。我希望高度與文字高度一樣多,並且可以調整大小。有什麼建議麼? –