day15--JavaScript

來源:互聯網
上載者:User

標籤:height   tom   定義   lin   size   for   code   看不見   char   

    上節作業回顧

    <style></style>代表的是CSS樣式

    <script></script>代表的是JavaScript樣式

    1、CSS重用

    <style>

             .c1{

                   }

              .c2{

                    }

    <div class="c1 c2"></div>

    2、自適應和改變大小變形

    左右捲軸的出現

    寬度,百分比(全部使用百分比就會變形)

    頁面最外層:像素的寬度(改變頁面大小,自動出現捲軸)    

    <form> action="http://www.alex.com" method="GET" enctype="multi圖片提交必須">

    <input type="text" name="q" />

 <input type="text" name="b" />

    <input type="submit" />

    </form>

    GET:http://www.alex.com?q=使用者輸入

    GET:http://www.alex.com?q=使用者輸入&b=使用者輸入

    圖片提交必須有enctype屬性

    CSS補充

        position: 返回頂部,頂部菜單不動

        position:

          fixed固定在某處位置

 

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>Title</title>    <style>        .c{            width:70px;            height:50px;            background-color:black;            color:white;            line-height:50px;            position:fixed;      #固定在某處,下面是設定固定的地方            bottom:20px;            right:10px;        }    </style>    <!-- position屬性的fixed代表固定在某處,定義position後,有四個屬性,top,left,right,bottom,距離螢幕的四個位置 --></head><body>    <div class="c">返回頂部</div>    <div style="height:5000px;background-color:aliceblue;"></div>    <!-- 兩個塊級標籤,層疊的形式,要想實現放置底部的效果,要實現網頁分層的效果 --></body></html>

 

    首行固定,漂浮在網頁頂端,兩層網頁

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <!--position屬性的fixed是固定網頁,margin-top屬性是自動讓標籤距螢幕的距離,fixed固定螢幕,固定了標籤,不會動的 -->    <title>Title</title>    <style>        .c1{            background-color:black;            height:30px;            color:white;            position:fixed;            left:0;            right:0;            top:0;        }        .c2{            background-color:pink;            height:5000px;            margin-top:31px;        }    </style></head><body>    <div class="c1">頂部網頁</div>    <div class="c2">下面網頁的資訊</div>    <div>草,怎麼看不見華倫</div>    <div>我擦,真的看不見呀,你媽媽的</div></body></html>

    上面HTML代碼中,position屬性中的fixed是固定網頁,而margin-top是讓<div>標籤距螢幕的距離,不會固定,是相對螢幕頂部位置。

 

               

 

day15--JavaScript

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.