html的定義:
1.超文件標(biāo)記言語
2.用來描述網(wǎng)頁的一種語言
3.一種標(biāo)記語言(不是編程語言)Hyper Text Markup Language
html 5 支持的瀏覽器:IE9+、谷歌会钝、火狐冗疮、Opera躁锁、Safari
瀏覽器內(nèi)核:
Trident(Avant崔挖、騰訊TT串塑、Netscape 8)
Gecko(Firefox碱工、Netscape6至9)
WebKit(Safari和Google的瀏覽器Chrome)
Presto(它取代了舊版Opera 4至6版本使用的Elektra排版引擎娃承,包括加入動(dòng)態(tài)功能,例如網(wǎng)頁或其部分可隨著DOM及Script語法的事件而重新排版)
html文檔聲明和注釋:
文檔聲明:<!DOCTYPE html>
注釋:
結(jié)構(gòu)標(biāo)簽:html怕篷、head历筝、body
head 頭部標(biāo)簽:
title:網(wǎng)頁標(biāo)簽
meta:
屬性:name、http-euiv廊谓、charset梳猪、content
實(shí)例:
設(shè)置網(wǎng)頁編碼:<metacharset="utf-8"/>
<metahttp-uquiv="content-type"content="text/html;charset=utf-8"/>
刷新頁面和跳轉(zhuǎn):
<metahttp-equiv="refresh"content="2;url=http://www.baidu.com"/>
關(guān)鍵字:<meta name="Keywords"content="關(guān)鍵字" />
描述: <meta name="Description" content="簡介、描述" />
<meta name="author"content="作者“/>
link:導(dǎo)入外部CSS樣式文件<link href="css/css.css"rel="stylesheet" type="text/css">
script:1.導(dǎo)入外部腳本文件2.在內(nèi)部定義腳本
style:在內(nèi)部定義CSS樣式
html 文本與文本格式:
html文本標(biāo)簽:p 定義段落蒸痹、b 定義加粗春弥、strong 強(qiáng)調(diào)加粗、i 定義斜體叠荠、em 強(qiáng)調(diào)斜體匿沛、cite 引用斜體、hn h1-h6 定義標(biāo)題 加粗 放大 自動(dòng)換行榛鼎、sub 下標(biāo)文字逃呼、sup 上標(biāo)文字
html本文格式標(biāo)簽:1.bdo dir屬性定義文本方向
2.q 定義引用 添加雙引號“”
3.abbr 定義縮寫 title屬性指定全寫
4.del 定義刪除文字 中劃線
5.time 定義時(shí)間 datetime屬性指定具體時(shí)間 html5新標(biāo)簽、
6.summary 定義details的標(biāo)題 html5
7.details 定義細(xì)節(jié) smmary定義其標(biāo)題 html5
8.dialog 定義對話 dt dd html5
實(shí)體標(biāo)簽:
⁢ <
> >
空號
&puot; ""
© 版權(quán)符號
× x
列表標(biāo)簽:
1.ul 定義無序列表
2.li 定義列表選項(xiàng)
3.ol 定義有序列表
4.dl,dt(標(biāo)題),dd(內(nèi)容) 定義定義列表
5.pre 預(yù)格式化輸出
6br 換行
表格標(biāo)簽(1):
<table 屬性=" "...>
<tr>
<th></th>//列(標(biāo)題)
</tr>
<tr>
<td></td>//行(內(nèi)容)
</tr>
</table>
表格標(biāo)簽(2):
<table border="1"(邊框的值) cellpadding="0"(清除單元格的默認(rèn)樣式) cespacing="0"(指單元格的間距)>
<thead>-----> 表頭
<tr>------> 表頭行
<th></th>-->表頭列
</tr>
</thead>------> 表頭
<tbody>------> 表身
<tr>-------> 表身行
<td></td>----> 表身列
</tr>
</tbody>-------> 表身
<tfoot>--------> 表尾
<tr>--------> 表尾行
<td></td>----> 表尾列
</tr>
</tfoot>---------> 表尾
</table>
注:表格中的三個(gè)類別里者娱,表頭和表尾可以省略不寫抡笼,但是表身必須要有。
1:border-collapse:collapse黄鳍;取消間距
2:colspan="3" 行的單元格合并
3:rowspan="2" 列的單元格合并
注:如果沒有內(nèi)容的話單元格要給高度和寬度推姻。(因?yàn)椴辉O(shè)置寬高的話單元格是根據(jù)內(nèi)容撐開)同理ul,ol,dl那些差不多,按照我個(gè)人習(xí)慣框沟,只要是個(gè)盒子的我基本都會給他一個(gè)寬高因?yàn)檫@樣不容易出BUG拾碌!
FROM表單:
密碼框:密碼:<input type="password" name="password"/>
文件上傳:頭像:<input type="file" name="header" />
自動(dòng)獲取焦點(diǎn):<input type="text" autofocus required/>
搜索功能:搜索:<input type="search" results required/>
數(shù)值:驗(yàn)證是否數(shù)字:<input type="number" name="sz"/>
驗(yàn)證郵箱:驗(yàn)證郵箱:<input type="emali" name="yx" autocomplete="on"/>
復(fù)選框:<input type="checkbox" name="">
單選框:<input type="radio" name="">
下拉列表:<select name=""> <option value="">XX</option></select>
文本域:<textarea row(行)="X" cols(列)="X">
按鈕:<input type="button" value="Hello word">
圍繞的數(shù)據(jù):
<fieldset>
<legend>健康信息</legend>
身高:<input type="text" />
體重:<input type="text" />
</fieldset>
提交表單:<input type="submit" value="Submit">
A 鏈接標(biāo)簽:
超鏈接:a 指定href
錨點(diǎn):1.a 指定name 其他元素指定錨點(diǎn) 2.URL :http://www.baidu.com/index.php#mao
mailto:href="mailto:郵箱地址"
路徑地址:1.相對地址 2.絕對地址
多媒體標(biāo)簽:
img(導(dǎo)入圖片)屬性: src吐葱、width、height校翔、border弟跑、usemap
map:把image分成不同區(qū)域、屬性 name指定map名字
area:把image區(qū)域的具體形狀
audio(導(dǎo)入音樂)屬性:src防症、controls孟辑、autoplay
viedo(導(dǎo)入視頻)屬性:src、controls蔫敲、autoplay饲嗽、poster、loop
source(導(dǎo)入視頻嵌套在viedo使用):src
mebed(導(dǎo)入資源 視頻 音頻):src
CSS:之前和大家說過CSS就是網(wǎng)頁的衣服和鞋子(可以使網(wǎng)頁排版更好看)下面就給大家列舉用得比較多的CSS屬性奈嘿。
字體屬性:
font-size
font-family
font-style:normal(正常 默認(rèn))貌虾、italic(斜體)、oblique(斜體)
font-weigth:normal(默認(rèn))裙犹、bold(粗)尽狠、bolder(更粗)、lighter(細(xì))叶圃、100=900(數(shù)值)
文本屬性:
字母間距l(xiāng)etter-spacing
單詞間距word-spacing
text-decoration:overline(上劃線)underline(下劃線)line-through(刪除線)none(沒效果)
text-align:left right center文本居中 補(bǔ)充:margin:0 auto盒子居中
text-indent:將段落的第一行縮進(jìn) X像素
line-height
word-wrap(CSS3):normal break-word(允許長單詞換行到下一行)
text-transform:none capitalize(首字母大寫) uppercase(大寫) lowercase(小寫)
cursor 屬性規(guī)定要顯示的光標(biāo)的類型(形狀)
背景屬性
background-color:
background-image:background-image:url()
background-repeat:repeat(默認(rèn)) on-repeat repeat repeat-x repeat-y
background-position:left/right/center/number px top/center/bottom.number px
background-attachment:scoll fixed(設(shè)置背景圖像是固定還是會跟著移動(dòng))
background:background:color/image/repeat/position/attachment
補(bǔ)充:
background-size(規(guī)定背景圖像的尺寸):
background:rgba(255,255,255,.8)//255,255,255代表顏色 .8代表背景透明度
background:-webkit-linear-gradient(top/bottom/left/bottom,rgba(0,0,0,.0),rgba(0,0,0,1));
顏色漸變
background:url(../images/sprite.png) no-repeat(圖片不平鋪) px(水平距離x) px(垂直距離y);背景共用一張圖片減少空間提高效率(淘寶袄膏,VIP都會用到的小圖)
邊框?qū)傩?/strong>:
border-style:none dotted dashed solid double groove ridge inset outset
border-color
border-top、border-bottom掺冠、border-left沉馆、border-right
列表屬性:
list-style-type
list-style-image
list-style-position:inside outside
list-style
內(nèi)補(bǔ)白\外補(bǔ)白
padding\margin-left
padding\margin-right
padding\margin-top
padding\margin-bottom
padding\margin:四個(gè)邊
padding\margin:上下 左右
padding\margin:上 左右 下
padding\margin:上 右 下 左
布局:
display:lnline(行內(nèi)元素) block(塊狀元素)inline-block none
visitility:visitable invisitable hidden
overflow:
overflow-x:(hidden)是否對內(nèi)容的左/右邊緣進(jìn)行裁剪
overflow-y:(hidden)是否對內(nèi)容的上/下邊緣進(jìn)行裁剪
float(浮動(dòng)):none left right
clear(清除):both left right
定位:
position:relative absolute fixed
left
right
top
bottom
z-index:層疊數(shù)值越大就在最上面
CSS選擇器
常用選擇器:
1.*通用選擇器 *{margin:0,padding:0;}
2.元素選擇器(如p,div,html,body等等)
3.ID選擇器,id="XX" #id(調(diào)用)
4.CLASS類選擇器德崭,class="XX" .XX(調(diào)用)
5.屬性選擇器斥黑,(在不帶有CLASS或者ID時(shí)可考慮用屬性選擇器)(只影響特定的那一行);標(biāo)簽[元素="目標(biāo)/數(shù)值"] {樣式}
6.后代選擇器S1 S2{ } DIV P{}
7.子代選擇器S1>S2{ } UL>LI{}
8.子元素選擇器:
:first-child選擇元素的第一個(gè)
:last-child選擇元素的最后一個(gè)
:nth-child() 這個(gè)是相對于父元素的
:nth-of-type()這個(gè)無論如何都是相對于第一個(gè)元素的
偽類選擇器:
常用偽類選擇器 標(biāo)簽 :hover 當(dāng)鼠標(biāo)懸停在其標(biāo)簽上時(shí)顯示其樣式
如:.navblock:hover .topnav-2th{
display:block;
}
選擇器順序
1.內(nèi)聯(lián)式樣式表>ID選擇器>(CLASS)類選擇器>元素選擇器>*通配符選擇器(最低順序)
2.在同一組屬性設(shè)置中標(biāo)有"!important"則優(yōu)先級最大
如:color:#00f !important;/優(yōu)先級最大/