簡體   English   中英

如何使用Google Chrome瀏覽器將頁腳停留在頁面底部?

[英]How do I stick my footer to bottom of the page with Google Chrome?

我有一個舊網站,最近我向該網站添加了頁腳菜單。 頁腳菜單應位於網站的頁腳,並位於其他所有內容的下方。 但是我發現使用Google Chrome瀏覽器后,頁腳顯得過高-在我網站的某些部分上方。 我嘗試過但沒有找到解決方法。 我嘗試在頁腳之前添加“ <center> ”,但這不能解決問題。

我在不同的瀏覽器上對此進行了測試,結果如下:

  • 使用Google Chrome Canary可以
  • 使用FireFox和Internet Explorer很好
  • 使用Opera和Safari很好
  • 使用Google Chrome瀏覽器無法正常工作

我在兩台計算機上進行了檢查(使用Windows,Google Chrome版本31.0.1650.63 m)。 Canary版本是34.0.1768.0 canary,看起來不錯。

頁腳包含表格和其他一些HTML元素,我嘗試禁用CSS,但不能解決問題。 您知道如何使頁腳出現在網站的頁腳嗎? 頁面的鏈接是http://www.speedysoftware.com/composer/appendix-7/該網站的幾頁上也出現了相同的問題。

這是頁腳的HTML:

<center>
<div class="footer" id="footer">

<div class="links_table" >
<table width="100%" cellspacing="0" cellpadding="0" border="0" class="bottomlinks" dir="ltr">
<tbody><tr align="center" valign="top">
<td align="center" width="100%">

<table cellspacing="5" cellpadding="0" border="0" dir="ltr">

<tbody><tr align="center" valign="top"><td><table cellspacing="0" cellpadding="0" border="0" dir="ltr"><tbody><tr align="center" valign="bottom">
<td nowrap="nowrap" dir="ltr"><a href="http://www.speedy.net/about/" title="About">About</a></td>
<td nowrap="nowrap" dir="ltr">&nbsp;·&nbsp;</td>
<td nowrap="nowrap" dir="ltr"><a href="http://www.speedy.net/privacy/" title="Privacy">Privacy</a></td>
<td nowrap="nowrap" dir="ltr">&nbsp;·&nbsp;</td>
<td nowrap="nowrap" dir="ltr"><a href="http://www.speedy.net/terms/" title="Terms of Service">Terms</a></td>
<td nowrap="nowrap" dir="ltr">&nbsp;·&nbsp;</td>
<td nowrap="nowrap" dir="ltr"><a href="http://www.speedy.net/contact/" title="Contact Us">Contact Us</a></td>
<td nowrap="nowrap" dir="ltr">&nbsp;·&nbsp;</td>
<td nowrap="nowrap" dir="ltr"><a href="http://sourceforge.net/project/project_donations.php?group_id=57192" title="Donate to Speedy Composer">Donate</a></td>
</tr></tbody></table></td></tr>

<tr align="center" valign="top"><td>&nbsp;</td></tr>

<tr align="center" valign="top"><td><table cellspacing="0" cellpadding="0" border="0" dir="ltr"><tbody><tr align="center" valign="bottom">
<td nowrap="nowrap" dir="ltr"><a href="http://www.speedy.net/" title="Speedy Net">Speedy Net</a></td>
<td nowrap="nowrap" dir="ltr">&nbsp;·&nbsp;</td>
<td nowrap="nowrap" dir="ltr"><a href="http://www.speedycomposer.com/" title="Speedy Composer">Speedy Composer</a></td>
<td nowrap="nowrap" dir="ltr">&nbsp;·&nbsp;</td>
<td nowrap="nowrap" dir="ltr"><a href="http://www.speedywhois.com/" title="Speedy Whois">Speedy Whois</a></td>
<td nowrap="nowrap" dir="ltr">&nbsp;·&nbsp;</td>
<td nowrap="nowrap" dir="ltr"><a href="http://www.speedy.net/wordpress/" title="Speedy Net WordPress">Speedy Net WordPress</a></td>
</tr></tbody></table></td></tr>

<tr align="center" valign="top"><td>&nbsp;</td></tr>

<tr align="center" valign="top"><td><table cellspacing="0" cellpadding="0" border="0" dir="ltr"><tbody><tr align="center" valign="bottom">
<td nowrap="nowrap" dir="ltr"><a href="http://www.cafepress.com/speedynet" title="Speedy Net's Shop">Speedy Net's Shop</a></td>
<td nowrap="nowrap" dir="ltr">&nbsp;·&nbsp;</td>
<td nowrap="nowrap" dir="ltr"><a href="http://www.cafepress.com/speedycomposer" title="Speedy Composer's Shop">Speedy Composer's Shop</a></td>
<td nowrap="nowrap" dir="ltr">&nbsp;·&nbsp;</td>
<td nowrap="nowrap" dir="ltr"><a href="http://www.cafepress.com/speedy_s" title="Speedy S-logo Shop">Speedy S-logo Shop</a></td>
</tr></tbody></table></td></tr>

<tr align="center" valign="top"><td>&nbsp;</td></tr>

<tr align="center" valign="top"><td><table cellspacing="0" cellpadding="0" border="0" dir="ltr"><tbody><tr align="center" valign="bottom">
<td nowrap="nowrap" dir="ltr"><a href="http://www.php.net/" title="PHP">PHP</a></td>
<td nowrap="nowrap" dir="ltr">&nbsp;·&nbsp;</td>
<td nowrap="nowrap" dir="ltr"><a href="http://www.mysql.com/" title="MySQL">MySQL</a></td>
<td nowrap="nowrap" dir="ltr">&nbsp;·&nbsp;</td>
<td nowrap="nowrap" dir="ltr"><a href="http://www.java.com/" title="Java">Java</a></td>
<td nowrap="nowrap" dir="ltr">&nbsp;·&nbsp;</td>
<td nowrap="nowrap" dir="ltr"><a href="http://www.mathworks.com/products/matlab/" title="MATLAB">MATLAB</a></td>
<td nowrap="nowrap" dir="ltr">&nbsp;·&nbsp;</td>
<td nowrap="nowrap" dir="ltr"><a href="http://www.gnu.org/software/octave/" title="Octave">Octave</a></td>
</tr></tbody></table></td>
</tr>

</tbody>
</table>

</td>
</tr>
</tbody></table>
</div>

</div>
</center>

這是CSS:

.footer, .push {
    /* .push must be the same height as .footer */
    /* height: 82px; */
    height: 102px;
}

.footer {
    text-align: center;
    /* border-top: 1px solid #B2CAFA; */
    clear: both;
    font-size: 13px;
    line-height: 1;
    position: relative;
}

.footer table {
    border-collapse: collapse;
    border-spacing: 0;
}

.footer a {
    text-decoration: none;
    font-weight: normal;
    font-size: 13px;
    color: #3D70A3 !important;
}

.footer a:visited {
    color: #3D70A3 !important;
}

.footer a:link {
    color: #3D70A3 !important;
}

.footer a:active {
    color: #3D70A3 !important;
}

.footer a:hover {
    text-decoration: underline;
}

.footer .links_table {
    padding-top: 10px;
}

我知道HTML並不完全有效,但是這是一個舊網站,我沒有時間進行驗證。 我只希望頁腳在所有瀏覽器中都位於正確的位置。 您知道如何解決此錯誤嗎?

我認為這是Chrome在訂購元素時的錯誤。

Chrome瀏覽器以奇怪的順序顯示dom元素,然后在刷新時修復

當我在檢查器中更改中心標簽的樣式(例如,將顯示更改為不同的值)時,它將正確呈現。 嘗試放置

<center>
...
</center>

<div style="margin: auto;">
...
</div>

並盡快使您的代碼成為標准!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM