標籤: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