Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537
為了方便學(xué)習(xí)和理解,通常將HTML5標(biāo)記分為兩大類,即雙標(biāo)記和單標(biāo)記。
a.雙標(biāo)記:
雙標(biāo)記雙標(biāo)記也稱為體標(biāo)記,分為開始標(biāo)記和結(jié)束標(biāo)記,其基本語法為:
<標(biāo)記名>內(nèi)容</標(biāo)記名>
如:
<p>我是一個雙標(biāo)記</p>
b.單標(biāo)記:
單標(biāo)記也稱空標(biāo)記,是指用一個標(biāo)記就可以完整的描述某個功能,其基本語法為:
<標(biāo)記名/>
如:
<hr/>
上面hr標(biāo)記表示一條水平線,后面會提到
注釋標(biāo)記是HTML的一種特殊標(biāo)記,它是一段便于閱讀理解的不需要在頁面中顯示的注釋文字。其基本語法格式為:
<!-- 注釋語句 -->
如:
<p>這是一段文本</p> <!-- 這是注釋文本,不會在頁面中顯示 -->
上圖即為瀏覽器中的結(jié)果。
HTML標(biāo)記的默認(rèn)樣式是無法滿足頁面開發(fā)的需求的,如果想要為某段文本設(shè)置特定的樣式,就需要用到HTML標(biāo)記的屬性了,其基本語法格式為:
<標(biāo)記名 屬性1="屬性值1" 屬性2="屬性值2" 屬性3="屬性值3"...>內(nèi)容</標(biāo)記名>
下面以一個例子來展示:
網(wǎng)頁第一行是一個二級居中的標(biāo)題,第二行是一個局中的段落,第三行是一個大小為2px,顏色為灰色的水平線,第四行是一段正常的段落,部分詞語被加粗
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h2 align="center">我是居中的二級標(biāo)題</h2>
<p align="center">我是居中的段落</p>
<hr size="2" color="#ccc"/>
<p>我是一個正常的段落,這是<strong>關(guān)鍵字</strong>,其他的都是正常內(nèi)容。<p/>
</body>
</html>
效果如圖所示:
?
多學(xué)一招(鍵值對):
“鍵值對”簡單地說即為對“屬性”設(shè)置“值”
例如:
color = "red";width:"200px";
上面的color和width就相當(dāng)于屬性1和屬性2,red和200px就是對應(yīng)的屬性值1和屬性值2,如果順序出錯,是沒有效果的
總結(jié):
在HTML開始標(biāo)記中,可以通過 屬性=“屬性值”的方式為標(biāo)記添加屬性,其中“屬性”和“屬性值”是以“鍵值對”的形式出現(xiàn)的
1.title
一個HTML文檔只能含有一對<title></title>標(biāo)記,<title></title>之間的內(nèi)容將顯示在瀏覽器窗口的標(biāo)題欄中。
基本語法格式:
<title>網(wǎng)頁標(biāo)題名稱</title>
2.meta
meta定義頁面元信息:
設(shè)置網(wǎng)頁關(guān)鍵字》》》<meta name=”keywords” content=”JAVA、php”/>
設(shè)置網(wǎng)頁描述》》》<meta name=”description” content=”IT培訓(xùn)教育”/>
設(shè)置網(wǎng)頁作者》》》<meta name=”author” content=”傳智播客”/>
設(shè)置字符集》》》<meta http-equiv=”Content-Type” content=”text/htm; charset=utf-8l”/>
設(shè)置頁面自動刷新與跳轉(zhuǎn)》》》<meta http-equiv=”refresh” content=”10;url=http://www.itcast.cn”/>
3.link
基本語法格式:
<link 屬性=”屬性值” />
屬性名 | 常用屬性值 | 描述 |
href | URL | 指定引用外部文檔 |
rel | stylesheet | 指定當(dāng)前文檔與引用外部文檔的關(guān)系,該屬性值通常為stylesheet,表示定義一個外部樣式表 |
type | text/css | 引用外部文檔的類型為CSS |
type | text/javascript | 引用外部文檔的類型為JavaScript腳本 |
4.style
基本語法格式:
<style 屬性=”屬性值”>樣式內(nèi)容</style>
在HTML中使用style標(biāo)記時,常常定義其屬性為type,相應(yīng)的屬性值為text/css,表示使用內(nèi)嵌式的CSS樣式
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>www.jb51.net 數(shù)組的方法</title> <script> var arr=[1,3,4] var arr1=["a","b","c"] var arr2=["d","e","f"] var arrNum=[] //1、向數(shù)組的末尾添加一條或多條元素,并返回新的長度 //arr.push("longzhoufeng") //console.log(arr)//1,3,4,"longzhoufeng" //2、向數(shù)組的最開始添加一條或多條元素,并返回新的長度 //arr.unshift("minigui")//IE6,7不支持 //console.log(arr)//"minigui", 1, 3, 4 //3、連接二個數(shù)組或者多個數(shù)組 //var newArr=arr.concat(arr1,arr2) //console.log(newArr)//[1, 3, 4, "a", "b", "c", "d", "e", "f"] //4、刪除并返回數(shù)組的第一個元素 //console.log(arr1.shift());//a //arr1.shift(); //console.log(arr1);//b,c //5、刪除并返回數(shù)組的最后一個元素 //console.log(arr1.pop());//c //arr1.pop() //console.log(arr1)//["a", "b"] //6、刪除,替換,添加 //arr1.splice(0,2)//0代表位置,2代表要刪除的個數(shù) //console.log(arr1)//["c"] //替換 //arr1.splice(0,1,"longzhoufeng")//第三個參就是在0位置上替換成longzhoufeng //arr1.splice(0,1,"longzhoufeng")//第三個參就是在0位置上替換成longzhoufeng //console.log(arr1)//["longzhoufeng", "b", "c"] //添加 //arr1.splice(1,0,"longzhoufeng") //console.log(arr1)//["a", "longzhoufeng", "b", "c"] //數(shù)組去重 var arr3=[1,3,3,2,5,6,7,7] //1、先遍歷數(shù)組的每一個元素 for(var i=0;i<arr3.length;i++){ //2、每遍歷對比一個,就得往前加一位 for(var j=i+1;j<arr3.length;j++){ //3、對遍歷的元素進(jìn)行對比,如果相等,就刪除后面的一個元素 if(arr3[i]==arr3[j]){ arr3.splice(j,1); //4、刪除之后就減少一位,直到?jīng)]有為止 j--; } } } console.log(arr3) //7、數(shù)組排序 var arr4=[4,3,5,5,76,2,0,8] //這種方法可能會有問題,因為sort()會把元素轉(zhuǎn)換成字符串 //arr4.sort(); //console.log(arr4)//0, 2, 3, 4, 5, 5, 76, 8 //sort()里面可以傳一個函數(shù),如果返回的是a-b就是從小到大,如果返回是b-a就從反方向排序 arr4.sort(function(a,b) { return a-b; }) console.log(arr4)//0, 2, 3, 4, 5, 5, 8, 76 var arr5=["345px","23px","10px","1000px"] arr5.sort(function(a,b) { return parseInt(a)-parseInt(b); }) console.log(arr5)//"10px", "23px", "345px", "1000px" </script> </head> <body> </body> </html>
行結(jié)果:
歡迎大家多多留言討論,如有錯誤請大神指教,如果你是小白也可以私信“資料”領(lǐng)取前端學(xué)習(xí)資料一起學(xué)習(xí)
Html是Hyper Text Mark-up Language 的首字母簡寫,意思是超文本標(biāo)記語言,超文本指的是超鏈接,標(biāo)記指的是標(biāo)簽,是一種用來制作網(wǎng)頁的語言,這種語言由一個個的標(biāo)簽組成,用這種語言制作的文件保存的是一個文本文件,文件的擴展名為html或者h(yuǎn)tm,一個html文件就是一個網(wǎng)頁,html文件用編輯器打開顯示的是文本,可以用文本的方式編輯它,如果用瀏覽器打開,瀏覽器會按照標(biāo)簽描述內(nèi)容文件渲染成網(wǎng)頁,顯示的網(wǎng)頁可以從一個網(wǎng)頁鏈接跳轉(zhuǎn)到另一個網(wǎng)頁。
Html中標(biāo)簽分為 :成對標(biāo)簽和自閉合標(biāo)簽【空標(biāo)簽】
成對出現(xiàn),有開始標(biāo)簽必須有結(jié)束標(biāo)簽,內(nèi)容包裹在兩個標(biāo)簽中,而且開始標(biāo)簽名和結(jié)束標(biāo)簽名一致,并且結(jié)束標(biāo)簽必須以斜杠/開頭
語法:
<font>內(nèi)容</font>
只有一個標(biāo)簽,用斜杠結(jié)束,斜杠也可以省略
語法:
<br/>
注意事項:
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
</head>
<body>
</body>
</html>
!DOCTYPE html是文檔聲明,定義文檔類型為html,并且告訴不同的瀏覽器用標(biāo)準(zhǔn)方式進(jìn)行解析html語言,如果不寫的話,會產(chǎn)生怪異模式,所謂怪異模式,就是瀏覽器會用自己的方式進(jìn)行解析,不同的瀏覽器有各自的解析方式,從而會出現(xiàn)無效果、不兼容等問題。
注意,html中有兩種聲明類型,一種叫做xhtml,即html,另一種叫做html5,html5是xhtml的升級版,所以我們建議使用html5的聲明方式
xhtml聲明方式:
<htmlxmlns="http://www.w3.org/1999/xhtml">
html5聲明方式:
<!DOCTYPE html>
html是html文檔的整體,也就是表示一個網(wǎng)頁。
html中的lang="en"是定義該文件語言是英文
head是html的第一層子元素【子標(biāo)簽】,負(fù)責(zé)對網(wǎng)頁進(jìn)行一些設(shè)置以及定義標(biāo)題,設(shè)置包括定義網(wǎng)頁的編碼格式,外鏈css樣式文件和JavaScript文件等。設(shè)置的內(nèi)容不會顯示在網(wǎng)頁上,標(biāo)題的內(nèi)容會顯示在標(biāo)題欄中。即title標(biāo)簽。
meta是html語言head標(biāo)簽中的一個輔助性標(biāo)簽,該標(biāo)簽不包含任何內(nèi)容,但是該標(biāo)簽的屬性定義了與文檔相關(guān)聯(lián)的名稱,比如:編碼
<meta charset="utf-8"></meta>
body也是html的第一層子元素,我們頁面中顯示的所有內(nèi)容全部都是編寫在該標(biāo)簽體中。
html制定了文檔的編寫規(guī)范,必須遵守。
所有的標(biāo)簽必須小寫
所有的屬性必須用雙引號括起來
html文檔代碼中可以插入注釋,注釋是對代碼的說明和解釋,注釋的內(nèi)容不會顯示在頁面上。
注釋的語法:
<!-- 注釋的內(nèi)容 -->
注:屬性是標(biāo)簽的輔助作用。
屬性 描述 bgcolor 設(shè)置網(wǎng)頁的背景顏色 background 設(shè)置網(wǎng)頁的背景圖片
設(shè)置網(wǎng)頁的背景顏色
<!DOCTYPE html>
<html lang="en">
<head>
<title>html的屬性</title>
</head>
<body bacolor="pink">
</body>
</html>
我們在開發(fā)網(wǎng)頁時,需要經(jīng)常的插入圖片、視頻、文件等一些操作,但是我們需要指定文件所在的位置,這個位置就是所謂的路徑
路徑分為:
設(shè)置網(wǎng)頁的背景圖片
<!DOCTYPE html>
<html lang="en">
<head>
<title>html的屬性</title>
</head>
<body background="../images/10.jpg">
</body>
</html>
注意事項:
bgcolor和background不能同時使用
background不能指定絕對路徑
網(wǎng)頁的組成:文字、圖片、視頻、超鏈接、列表、表格、表單等組成。
標(biāo)簽 描述 hn 設(shè)置文字標(biāo)題【n:取值范圍 1~6】 center 居中對齊 hr 水平線 屬性(width:寬度 color:顏色 size:粗細(xì)) br 換行 p 段落
標(biāo)簽 描述 font 設(shè)置字體,需要借助屬性設(shè)置
屬性 描述 color 設(shè)置字體顏色 size 設(shè)置字體大小,不需要帶單位,取值范圍:1~7【瀏覽器默認(rèn)值:3】 face 設(shè)置字體風(fēng)格
<font size="2" color="red" face="黑體"></font>
標(biāo)簽 描述 b 定義粗體文本 em 定義著重文字 i 定義斜體文字 small 定義小號字 strong 定義加重語氣 sub 定義下標(biāo)字 sup 定義上標(biāo)字 ins 定義插入字 del 定義刪除字
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Html文本格式化標(biāo)簽</title>
</head>
<body>
<b>粗體文本</b>
<i>傾斜文本</i>
<em>著重文本</em>
<small>小號字</small>
<strong>加重語氣</strong>
<sub>上標(biāo)</sub>
<sup>下標(biāo)</sup>
<ins>插入字</ins>
<del>刪除字</del>
</body>
</html>
在Html中,圖像由
標(biāo)簽定義。
是空標(biāo)簽,意思是說,它只包含屬性。
要在頁面上顯示圖像,你需要使用源屬性(src)。src指"source"。源屬性的值是圖像的URL地址。
標(biāo)簽 描述 img 圖片標(biāo)簽
屬性 描述 src 指定圖片的地址 width 設(shè)置圖片的寬度 height 設(shè)置圖片的高度 alt 設(shè)置圖片的預(yù)備文本
注意事項:不建議設(shè)置圖片大小,容易失真
在Html中,聲音由標(biāo)簽定義。
標(biāo)簽 描述 audio 聲音標(biāo)簽
屬性 描述 src 指定聲音地址
<audio src="nice.mp3">對不起,您的瀏覽器不支持</audio>
在Html中,視頻由video標(biāo)簽定義
標(biāo)簽 描述 video 視頻標(biāo)簽
屬性 描述 src 指定視頻地址
<video src="美女.mp4">對不起,您的瀏覽器不支持</video>
a標(biāo)簽定義超鏈接,用于從一個頁面鏈接到另一個頁面。
a標(biāo)簽最重要的屬性是href,它指定鏈接的目標(biāo)。
在所有瀏覽器中,鏈接的默認(rèn)外觀如下:
未被訪問的鏈接帶有下劃線而且是藍(lán)色的
已被訪問的鏈接帶有下劃線而且是紫色的
活動鏈接帶有下劃線而且是紅色的
語法:
<a href="鏈接目標(biāo)">點擊內(nèi)容</a>
屬性 描述 href 指定鏈接目標(biāo) name 指定錨的名稱 download 指定下載鏈接 target 指定跳轉(zhuǎn)方式 屬性值 描述 _blank 新窗口打開【常用】 _parent 在父窗口中打開鏈接【了解】 _self 默認(rèn),在當(dāng)前窗口打開【了解】 _top 在當(dāng)前窗體打開鏈接,并替換當(dāng)前的整個窗體【了解】 framename 到 iframe 在講【常用】
超鏈接分類:
列表的使用與word等軟件的列表概念相似,只不過是應(yīng)用在網(wǎng)頁展示中。
有序列表是指有數(shù)字編號或字母的列表項,可以使用css定義更多樣式。
<!-- 有序列表 -->
<ol type="a">
<li>新聞一</li>
<li>新聞二</li>
<li>新聞三</li>
</ol>
屬性 描述 type 設(shè)置符號類型 值:1 a A I i 默認(rèn)數(shù)字 start 從第幾個開始【用于ol標(biāo)簽中】 value 從第幾個開始【用于li標(biāo)簽中】
<!-- 有序列表 -->
<ol type="a" start="4">
<li>新聞一</li>
<li type="1" value="1">新聞二</li>
<li>新聞三</li>
</ol>
無序列表是指沒有數(shù)字編號或字母的列表項,可以使用css定義更多樣式。
<!-- 無序列表 -->
<ul>
<li>童裝</li>
<li>男裝</li>
<li>女裝</li>
</ul>
屬性 描述 type 用于設(shè)置符號類型,默認(rèn):實心圓 值:空心圓、正方形 【用于ul、li】
<!-- 無序列表 -->
<ul type="square">
<li>童裝</li>
<li type="circle">男裝</li>
<li>女裝</li>
</ul>
描述列表指每個列表項有單獨的標(biāo)題。
<!-- 描述列表 -->
<dl>
<dt>開源產(chǎn)品</dt>
<dd>Java封裝庫</dd>
<dd>Web組件庫</dd>
<dt>網(wǎng)站導(dǎo)航</dt>
<dd>mrliujava.com</dd>
<dd>mrliuweb.com</dd>
</dl>
表格在網(wǎng)頁開發(fā)中使用頻率非常高,尤其是數(shù)據(jù)展示的時候。
標(biāo)簽 描述 table 代表表格標(biāo)簽 caption 表格標(biāo)題 thead 表頭部分 tbody 表格主體部分 tfoot 表格尾部
屬性 描述 border 表格邊框 cellspacing 單元格與單元格間距 width 寬度 height 高度 bgcolor 設(shè)置背景顏色 background 設(shè)置背景圖片 align 對齊方式
<!-- 表格 -->
<table border="1" cellspacing="0" width="600px" height="200px">
<caption>員工薪資統(tǒng)計表</caption>
<thead>
<tr>
<th>序號</th>
<th>姓名</th>
<th>性別</th>
<th>職位</th>
<th>薪資</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>狗蛋</td>
<td>男</td>
<td>JavaEe工程師</td>
<td>8780</td>
</tr>
<tr>
<td>2</td>
<td>黑妞</td>
<td>女</td>
<td>Web前端工程師</td>
<td>9750</td>
</tr>
<tr>
<td>3</td>
<td>傻蛋</td>
<td>妖</td>
<td>測試工程師</td>
<td>996</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>當(dāng)前頁:1 頁</td>
<td>上一頁</td>
<td>下一頁</td>
<td>尾頁</td>
<td>共 3 頁</td>
</tr>
</tfoot>
</table>
屬性 說明 rowspan 行合并 colspan 列合并
下面是行合并:
<!-- 表格 -->
<table border="1" cellspacing="0" width="600px" height="200px">
<caption>員工薪資統(tǒng)計表</caption>
<thead>
<tr>
<th>序號</th>
<th>姓名</th>
<th>性別</th>
<th>職位</th>
<th>薪資</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>狗蛋</td>
<td>男</td>
<td rowspan="2">JavaEe工程師</td>
<td>8780</td>
</tr>
<tr>
<td>2</td>
<td>黑妞</td>
<td>女</td>
<td>9750</td>
</tr>
<tr>
<td>3</td>
<td>傻蛋</td>
<td>妖</td>
<td>測試工程師</td>
<td>996</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>當(dāng)前頁:1 頁</td>
<td>上一頁</td>
<td>下一頁</td>
<td>尾頁</td>
<td>共 3 頁</td>
</tr>
</tfoot>
</table>
下面是列合并:
<!-- 表格 -->
<table border="1" cellspacing="0" width="600px" height="200px">
<caption>員工薪資統(tǒng)計表</caption>
<thead>
<tr>
<th>序號</th>
<th>姓名</th>
<th>性別</th>
<th>職位</th>
<th>薪資</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>狗蛋</td>
<td>男</td>
<td>JavaEe工程師</td>
<td>8780</td>
</tr>
<tr>
<td>2</td>
<td>黑妞</td>
<td>女</td>
<td>Web前端工程師</td>
<td>9750</td>
</tr>
<tr>
<td>3</td>
<td colspan="2">傻蛋</td>
<td>測試工程師</td>
<td>996</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>當(dāng)前頁:1 頁</td>
<td>上一頁</td>
<td>下一頁</td>
<td>尾頁</td>
<td>共 3 頁</td>
</tr>
</tfoot>
</table>
表單是一個包含表單元素的區(qū)域。
表單元素是允許用戶在表單中輸入內(nèi)容,比如:文本域(textarea)、下拉列表(select)、單選框(radio)、復(fù)選框(checkbox)等等。
表單需要使用表單標(biāo)簽來設(shè)置:
<!-- 表單 -->
<form>
input元素
</form>
屬性 說明 action 后臺地址 method 提交方式GET或POST
GET和POST區(qū)別:
1.GET
2.POST
<form action="后端接口" method="POST">
<input type="text">
<input type="password">
</form>
使用label用于描述表單標(biāo)題,當(dāng)點擊標(biāo)題后文本框會獲得焦點,需要保證使用的ID在頁面中是唯一的。
<form action="后端接口" method="POST">
<label for="username">用戶名</label>
<input type="text" id="username">
<label for="password">密碼</label>
<input type="password" id="password">
</form>
也可以將文本框放在label標(biāo)簽內(nèi)部,這樣就不需要設(shè)置id與for屬性了。
文本框用于輸入單行文本使用,下面是常用屬性與示例。
屬性 說明 type 表單類型,默認(rèn)為text name 后端接收字段名 required 必須輸入 placeholder 提示文本內(nèi)容 value 默認(rèn)指 maxlength 允許最大輸入字符數(shù) size 表單長度,一般用css來控制 disabled 禁用,不可提交后端 readonly 只讀,可提交后端 accept 設(shè)置選中類型 比如:.jpg capture 使用麥克風(fēng)\視頻或攝像頭哪種方式獲取手機上傳文件,支持的值有microphone , video , camera
<form action="后端接口" method="POST">
<label for="username">用戶名</label>
<input type="text" name="username" id="username" placeholder="請輸入用戶名" maxlength="5" size="50" required>
</form>
當(dāng)input類型為file時手機會讓用戶選擇圖片或者拍照,如果想直接調(diào)取攝像頭使用以下代碼.
<form action="后端接口" method="POST">
<label for="file">上傳文件</label>
<input type="file" name="file" id="file" accept="*.jpg" capture="camera">
</form>
通過設(shè)置表單的type字段可以指定不同的輸入內(nèi)容.
類型 說明 email 輸入內(nèi)容為郵箱 url 輸入內(nèi)容為URL地址 password 輸入內(nèi)容為密碼項 tel 電話號,移動端會調(diào)出數(shù)字鍵盤 search 搜索框 hidden 隱藏表單 submit 提交表單 reset 重置表單 button 自定義按鈕
隱藏表單用于提交后臺數(shù)據(jù),但在前臺內(nèi)容不顯示所以在其上做用樣式定義也沒有意義.
<input type="hidden" name="id" value="1">
創(chuàng)建提交按鈕可以將表單數(shù)據(jù)提交到后臺,有多種方式可以提交數(shù)據(jù),比如:AJAX,或者Html的表單按鈕.
a.使用input構(gòu)建提交按鈕,如果設(shè)置了name值,那么按鈕數(shù)據(jù)也會提交到后臺,如果有多個表單項可以通過這些進(jìn)行判斷是哪個表單提交的.
<input type="submit" name="submit" value="提交表單">
b.使用button也可以提交,設(shè)置type屬性為submit或不設(shè)置都可以提交表單.
<button type="submit">提交表單</button>
通過為表單設(shè)置disabled或readonly都可以禁止表單,單readonly表單的數(shù)據(jù)可以提交到后端
<input type="text" value="數(shù)據(jù)" readonly>
表單可以通過設(shè)置pattern屬性指定正則驗證.
屬性 說明 pattern 正則表達(dá)式驗證規(guī)則 oninvalid 輸入錯誤時觸發(fā)的事件
<form action="">
<label for="username">用戶名</label>
<input type="text" name="username" id="username" pattern="[a-z]{5,20}" oninvalid="validate('請輸入5~20位字母的用戶名')">
<button>提交表單</button>
</form>
<script>
function validate(message){
alert(message);
}
</script>
文本域指可以輸入多行文本的表單,當(dāng)然更復(fù)雜的情況可以使用編輯器如ueditor , ckeditor等.
屬性 說明 cols 列字符數(shù)(一般使用css控制更好) rows 行數(shù)(一般使用css控制更好)
<textarea cols="30" rows="3">請踩踩我......</textarea>
下拉列表項可用于多個值中的選擇.
屬性 說明 multiple 支持多選 size 列表框高度 optgroup 選項組 selected 選中狀態(tài) option 選項值
<form action="">
<select multiple size="10">
<option value="">選擇課程</option>
<optgroup label="后端">
<option value="">JAVA</option>
<option value="">PHP</option>
<option value="">LINUX</option>
</optgroup>
<optgroup label="前端">
<option value="">HTML</option>
<option value="">CSS</option>
<option value="">JAVASCRIPT</option>
</optgroup>
</select>
</form>
單選框指只能選擇一個選項的表單,如性別的選擇:男 , 女 , 保密 只能選擇一個.
屬性 說明 checked 選中狀態(tài)
<form action="">
<input type="radio" name="" id="boy" checked>
<label for="boy">男</label>
<input type="radio" name="" id="girl">
<label for="girl">女</label>
</form>
復(fù)選框指允許選擇多個值的表單
屬性 說明 checked 選中狀態(tài)
<form action="">
<input type="checkbox" name="JAVA" id="java">
<label for="java">JAVA</label>
<input type="checkbox" name="WEB" id="web">
<label for="web">WEB</label>
</form>
文件上傳有很多方式,可以使用插件或者JS拖放上傳處理.Html本身也提供了默認(rèn)的上傳功能,只是上傳效果并不是很美觀.
屬性 說明 multiple 支持多選 accept 允許上傳類型.png , .psd 或者 image/png , image/gif
<form action="" enctype="multipart/form-data">
<input type="file">
<input type="submit" value="上傳">
</form>
屬性 說明 min 最小時間 max 最大時間 step 間隔: date缺省是1天 week缺省是1周 month缺省是1月
a.日期選擇
<h1>日期選擇</h1>
<form action="">
<input type="date" step="5" min="2020-09-22" max="2025-01-15" name="datetime">
</form>
b.周選擇
<h1>周選擇</h1>
<input type="week" name="" id="">
c.月份選擇
<h1>月選擇</h1>
<input type="month" name="" id="">
d.日期與時間
<h1>日期與時間</h1>
<input type="datetime-local" name="" id="">
input表單的輸入值選項列表
<form action="">
<label for="username">用戶名</label>
<input type="text" name="" id="usernmae" list="less">
<datalist id="less">
<option value="JAVA">后臺管理語言</option>
<option value="CSS">美化網(wǎng)站頁面</option>
<option value="MYSQL">掌握數(shù)據(jù)庫使用</option>
</datalist>
</form>
frameset元素可定義一個框架集。它被用來組織多個窗口(框架),每個框架存有獨立的文檔,在其最簡單的應(yīng)用中,frameset元素僅僅會規(guī)定在框架集中存在多少列或多少行,您必須使用cols或rows屬性。
注意事項:由于是分割原網(wǎng)頁,所以我們不能在body中進(jìn)行編寫,在head中進(jìn)行分割。
標(biāo)簽 說明 frameset 框架集 frame 框架
屬性 說明 cols 定義框架集中列的數(shù)目和尺寸 rows 定義框架集中行的數(shù)目和尺寸 frame border 去除框架邊框 scrolling 去除滾動條
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Html垂直框架</title>
<frameset cols="50%,*" >
<frame src="http://www.baidu.com" frameborder="0" scrolling="no"></frame>
<frame src="http://www.taobao.com" frameborder="0" scrolling="no"></frame>
</frameset>
</head>
<body>
</body>
</html>
12.2 水平框架
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Html水平框架</title>
<frameset rows="50%,*" >
<frame src="http://www.baidu.com" frameborder="0" scrolling="no"></frame>
<frame src="http://www.taobao.com" frameborder="0" scrolling="no"></frame>
</frameset>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Html混合框架</title>
<frameset rows="20%,*" >
<frame src="http://www.baidu.com" frameborder="0" scrolling="no"></frame>
<frameset cols="20%,*">
<frame src="http://www.taobao.com" frameborder="0" scrolling="no"></frame>
<frame src="https://www.huya.com/" frameborder="0" scrolling="no"></frame>
</frameset>
</frameset>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Html美女</title>
</head>
<body>
<img src="../images/10.jpg" alt="">
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Html野獸</title>
</head>
<body>
<img src="../images/timg.gif" alt="">
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Html動物</title>
</head>
<body>
<img src="../images/4.jpg" alt="">
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Html鏈接</title>
</head>
<body>
<a href="Html美女.html" target="view">美女圖片</a>
<a href="Html野獸.html" target="view">野獸圖片</a>
<a href="Html動物.html" target="view">動物圖片</a>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Html垂直框架</title>
<frameset rows="20%,*" >
<frame src="http://www.baidu.com" frameborder="0" scrolling="no"></frame>
<frameset cols="20%,*">
<frame src="Html鏈接.html" frameborder="0" scrolling="no"></frame>
<frame src="https://www.huya.com/" frameborder="0" scrolling="no" name="view"></frame>
</frameset>
</frameset>
</head>
<body>
</body>
</html>
iframe元素會創(chuàng)建包含另外一個文檔的內(nèi)聯(lián)框架。
屬性 說明 align 對齊方式,后期采用css的方式進(jìn)行設(shè)置 width 設(shè)置寬度 height 設(shè)置高度 src 設(shè)置iframe中顯示的文檔的URL name iframe的名稱 scrolling 是否顯示滾動條 frameborder 設(shè)置iframe的邊框
*請認(rèn)真填寫需求信息,我們會在24小時內(nèi)與您取得聯(lián)系。