HTML,html教程

來源:互聯網
上載者:User

HTML,html教程

<html><head><title></title><style type="text/css">html, body{margin:0;padding:0;}.top{width:100%;height:36px;background-color: #ff0000;z-index:9999;}.bottom{width:100%;height: 36px;margin-top:52px;background-color: #0000ff;float:left;border-top:2px solid black;position:relative;bottom:0;}.centerHeight{width:100%;height:60px;background-color: #00ff00;float:left;margin-top:60px;border-top:2px solid black;}.topMargin{margin-top:36px;}.bottomMargin{border-bottom:2px solid black;}</style></head><body><div id="topDiv" class="top"><div><div id="centerDiv" class="centerHeight topMargin"><div><div id="centerDiv" class="centerHeight"><div><div id="centerDiv" class="centerHeight"><div><div id="centerDiv" class="centerHeight"><div><div id="centerDiv" class="centerHeight"><div><div id="centerDiv" class="centerHeight bottomMargin"><div><div id="buttomDiv" class="bottom"><div><script>                var BodyHeight = document.body.scrollHeight;        var ClientHeight = window.screen.height;        if (BodyHeight <= ClientHeight) {            document.getElementById("buttomDiv").style.position = 'absolute';            document.getElementById("buttomDiv").style.bottom = '0px';            document.getElementById("buttomDiv").style.width = '100%';        }</script></body></html>


↑ 這是在Firefox裡看到的效果,解析度:279*340↓ 下面這個是捲軸滾到最下面的效果

↑ 這個是在Firefox裡瀏覽,解析度為:285*528

這是JS更改的效果,可以看的出來擷取到網頁瀏覽的大小其實是擷取捲軸的大小,如果你擷取document.body.clientHeight,當解析度過低的時候就會擷取到0,就會導致錯誤。

這個是原來的樣式,這個就不解釋了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.