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
Html是Hyper Text Mark-up Language 的首字母簡(jiǎn)寫,意思是超文本標(biāo)記語(yǔ)言,超文本指的是超鏈接,標(biāo)記指的是標(biāo)簽,是一種用來(lái)制作網(wǎng)頁(yè)的語(yǔ)言,這種語(yǔ)言由一個(gè)個(gè)的標(biāo)簽組成,用這種語(yǔ)言制作的文件保存的是一個(gè)文本文件,文件的擴(kuò)展名為html或者h(yuǎn)tm,一個(gè)html文件就是一個(gè)網(wǎng)頁(yè),html文件用編輯器打開顯示的是文本,可以用文本的方式編輯它,如果用瀏覽器打開,瀏覽器會(huì)按照標(biāo)簽描述內(nèi)容文件渲染成網(wǎng)頁(yè),顯示的網(wǎng)頁(yè)可以從一個(gè)網(wǎng)頁(yè)鏈接跳轉(zhuǎn)到另一個(gè)網(wǎng)頁(yè)。
Html中標(biāo)簽分為 :成對(duì)標(biāo)簽和自閉合標(biāo)簽【空標(biāo)簽】
成對(duì)出現(xiàn),有開始標(biāo)簽必須有結(jié)束標(biāo)簽,內(nèi)容包裹在兩個(gè)標(biāo)簽中,而且開始標(biāo)簽名和結(jié)束標(biāo)簽名一致,并且結(jié)束標(biāo)簽必須以斜杠/開頭
語(yǔ)法:
<font>內(nèi)容</font>
只有一個(gè)標(biāo)簽,用斜杠結(jié)束,斜杠也可以省略
語(yǔ)法:
<br/>
注意事項(xiàng):
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
</head>
<body>
</body>
</html>
!DOCTYPE html是文檔聲明,定義文檔類型為html,并且告訴不同的瀏覽器用標(biāo)準(zhǔn)方式進(jìn)行解析html語(yǔ)言,如果不寫的話,會(huì)產(chǎn)生怪異模式,所謂怪異模式,就是瀏覽器會(huì)用自己的方式進(jìn)行解析,不同的瀏覽器有各自的解析方式,從而會(huì)出現(xiàn)無(wú)效果、不兼容等問題。
注意,html中有兩種聲明類型,一種叫做xhtml,即html,另一種叫做html5,html5是xhtml的升級(jí)版,所以我們建議使用html5的聲明方式
xhtml聲明方式:
<htmlxmlns="http://www.w3.org/1999/xhtml">
html5聲明方式:
<!DOCTYPE html>
html是html文檔的整體,也就是表示一個(gè)網(wǎng)頁(yè)。
html中的lang="en"是定義該文件語(yǔ)言是英文
head是html的第一層子元素【子標(biāo)簽】,負(fù)責(zé)對(duì)網(wǎng)頁(yè)進(jìn)行一些設(shè)置以及定義標(biāo)題,設(shè)置包括定義網(wǎng)頁(yè)的編碼格式,外鏈css樣式文件和JavaScript文件等。設(shè)置的內(nèi)容不會(huì)顯示在網(wǎng)頁(yè)上,標(biāo)題的內(nèi)容會(huì)顯示在標(biāo)題欄中。即title標(biāo)簽。
meta是html語(yǔ)言head標(biāo)簽中的一個(gè)輔助性標(biāo)簽,該標(biāo)簽不包含任何內(nèi)容,但是該標(biāo)簽的屬性定義了與文檔相關(guān)聯(lián)的名稱,比如:編碼
<meta charset="utf-8"></meta>
body也是html的第一層子元素,我們頁(yè)面中顯示的所有內(nèi)容全部都是編寫在該標(biāo)簽體中。
html制定了文檔的編寫規(guī)范,必須遵守。
所有的標(biāo)簽必須小寫
所有的屬性必須用雙引號(hào)括起來(lái)
html文檔代碼中可以插入注釋,注釋是對(duì)代碼的說(shuō)明和解釋,注釋的內(nèi)容不會(huì)顯示在頁(yè)面上。
注釋的語(yǔ)法:
<!-- 注釋的內(nèi)容 -->
注:屬性是標(biāo)簽的輔助作用。
屬性 描述 bgcolor 設(shè)置網(wǎng)頁(yè)的背景顏色 background 設(shè)置網(wǎng)頁(yè)的背景圖片
設(shè)置網(wǎng)頁(yè)的背景顏色
<!DOCTYPE html>
<html lang="en">
<head>
<title>html的屬性</title>
</head>
<body bacolor="pink">
</body>
</html>
我們?cè)陂_發(fā)網(wǎng)頁(yè)時(shí),需要經(jīng)常的插入圖片、視頻、文件等一些操作,但是我們需要指定文件所在的位置,這個(gè)位置就是所謂的路徑
路徑分為:
設(shè)置網(wǎng)頁(yè)的背景圖片
<!DOCTYPE html>
<html lang="en">
<head>
<title>html的屬性</title>
</head>
<body background="../images/10.jpg">
</body>
</html>
注意事項(xiàng):
bgcolor和background不能同時(shí)使用
background不能指定絕對(duì)路徑
網(wǎng)頁(yè)的組成:文字、圖片、視頻、超鏈接、列表、表格、表單等組成。
標(biāo)簽 描述 hn 設(shè)置文字標(biāo)題【n:取值范圍 1~6】 center 居中對(duì)齊 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 定義小號(hào)字 strong 定義加重語(yǔ)氣 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>小號(hào)字</small>
<strong>加重語(yǔ)氣</strong>
<sub>上標(biāo)</sub>
<sup>下標(biāo)</sup>
<ins>插入字</ins>
<del>刪除字</del>
</body>
</html>
在Html中,圖像由
標(biāo)簽定義。
是空標(biāo)簽,意思是說(shuō),它只包含屬性。
要在頁(yè)面上顯示圖像,你需要使用源屬性(src)。src指"source"。源屬性的值是圖像的URL地址。
標(biāo)簽 描述 img 圖片標(biāo)簽
屬性 描述 src 指定圖片的地址 width 設(shè)置圖片的寬度 height 設(shè)置圖片的高度 alt 設(shè)置圖片的預(yù)備文本
注意事項(xiàng):不建議設(shè)置圖片大小,容易失真
在Html中,聲音由標(biāo)簽定義。
標(biāo)簽 描述 audio 聲音標(biāo)簽
屬性 描述 src 指定聲音地址
<audio src="nice.mp3">對(duì)不起,您的瀏覽器不支持</audio>
在Html中,視頻由video標(biāo)簽定義
標(biāo)簽 描述 video 視頻標(biāo)簽
屬性 描述 src 指定視頻地址
<video src="美女.mp4">對(duì)不起,您的瀏覽器不支持</video>
a標(biāo)簽定義超鏈接,用于從一個(gè)頁(yè)面鏈接到另一個(gè)頁(yè)面。
a標(biāo)簽最重要的屬性是href,它指定鏈接的目標(biāo)。
在所有瀏覽器中,鏈接的默認(rèn)外觀如下:
未被訪問的鏈接帶有下劃線而且是藍(lán)色的
已被訪問的鏈接帶有下劃線而且是紫色的
活動(dòng)鏈接帶有下劃線而且是紅色的
語(yǔ)法:
<a href="鏈接目標(biāo)">點(diǎn)擊內(nèi)容</a>
屬性 描述 href 指定鏈接目標(biāo) name 指定錨的名稱 download 指定下載鏈接 target 指定跳轉(zhuǎn)方式 屬性值 描述 _blank 新窗口打開【常用】 _parent 在父窗口中打開鏈接【了解】 _self 默認(rèn),在當(dāng)前窗口打開【了解】 _top 在當(dāng)前窗體打開鏈接,并替換當(dāng)前的整個(gè)窗體【了解】 framename 到 iframe 在講【常用】
超鏈接分類:
列表的使用與word等軟件的列表概念相似,只不過是應(yīng)用在網(wǎng)頁(yè)展示中。
有序列表是指有數(shù)字編號(hào)或字母的列表項(xiàng),可以使用css定義更多樣式。
<!-- 有序列表 -->
<ol type="a">
<li>新聞一</li>
<li>新聞二</li>
<li>新聞三</li>
</ol>
屬性 描述 type 設(shè)置符號(hào)類型 值:1 a A I i 默認(rèn)數(shù)字 start 從第幾個(gè)開始【用于ol標(biāo)簽中】 value 從第幾個(gè)開始【用于li標(biāo)簽中】
<!-- 有序列表 -->
<ol type="a" start="4">
<li>新聞一</li>
<li type="1" value="1">新聞二</li>
<li>新聞三</li>
</ol>
無(wú)序列表是指沒有數(shù)字編號(hào)或字母的列表項(xiàng),可以使用css定義更多樣式。
<!-- 無(wú)序列表 -->
<ul>
<li>童裝</li>
<li>男裝</li>
<li>女裝</li>
</ul>
屬性 描述 type 用于設(shè)置符號(hào)類型,默認(rèn):實(shí)心圓 值:空心圓、正方形 【用于ul、li】
<!-- 無(wú)序列表 -->
<ul type="square">
<li>童裝</li>
<li type="circle">男裝</li>
<li>女裝</li>
</ul>
描述列表指每個(gè)列表項(xiàng)有單獨(dú)的標(biāo)題。
<!-- 描述列表 -->
<dl>
<dt>開源產(chǎn)品</dt>
<dd>Java封裝庫(kù)</dd>
<dd>Web組件庫(kù)</dd>
<dt>網(wǎng)站導(dǎo)航</dt>
<dd>mrliujava.com</dd>
<dd>mrliuweb.com</dd>
</dl>
表格在網(wǎng)頁(yè)開發(fā)中使用頻率非常高,尤其是數(shù)據(jù)展示的時(shí)候。
標(biāo)簽 描述 table 代表表格標(biāo)簽 caption 表格標(biāo)題 thead 表頭部分 tbody 表格主體部分 tfoot 表格尾部
屬性 描述 border 表格邊框 cellspacing 單元格與單元格間距 width 寬度 height 高度 bgcolor 設(shè)置背景顏色 background 設(shè)置背景圖片 align 對(duì)齊方式
<!-- 表格 -->
<table border="1" cellspacing="0" width="600px" height="200px">
<caption>員工薪資統(tǒng)計(jì)表</caption>
<thead>
<tr>
<th>序號(hào)</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>測(cè)試工程師</td>
<td>996</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>當(dāng)前頁(yè):1 頁(yè)</td>
<td>上一頁(yè)</td>
<td>下一頁(yè)</td>
<td>尾頁(yè)</td>
<td>共 3 頁(yè)</td>
</tr>
</tfoot>
</table>
屬性 說(shuō)明 rowspan 行合并 colspan 列合并
下面是行合并:
<!-- 表格 -->
<table border="1" cellspacing="0" width="600px" height="200px">
<caption>員工薪資統(tǒng)計(jì)表</caption>
<thead>
<tr>
<th>序號(hào)</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>測(cè)試工程師</td>
<td>996</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>當(dāng)前頁(yè):1 頁(yè)</td>
<td>上一頁(yè)</td>
<td>下一頁(yè)</td>
<td>尾頁(yè)</td>
<td>共 3 頁(yè)</td>
</tr>
</tfoot>
</table>
下面是列合并:
<!-- 表格 -->
<table border="1" cellspacing="0" width="600px" height="200px">
<caption>員工薪資統(tǒng)計(jì)表</caption>
<thead>
<tr>
<th>序號(hào)</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>測(cè)試工程師</td>
<td>996</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>當(dāng)前頁(yè):1 頁(yè)</td>
<td>上一頁(yè)</td>
<td>下一頁(yè)</td>
<td>尾頁(yè)</td>
<td>共 3 頁(yè)</td>
</tr>
</tfoot>
</table>
表單是一個(gè)包含表單元素的區(qū)域。
表單元素是允許用戶在表單中輸入內(nèi)容,比如:文本域(textarea)、下拉列表(select)、單選框(radio)、復(fù)選框(checkbox)等等。
表單需要使用表單標(biāo)簽來(lái)設(shè)置:
<!-- 表單 -->
<form>
input元素
</form>
屬性 說(shuō)明 action 后臺(tái)地址 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)點(diǎn)擊標(biāo)題后文本框會(huì)獲得焦點(diǎn),需要保證使用的ID在頁(yè)面中是唯一的。
<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屬性了。
文本框用于輸入單行文本使用,下面是常用屬性與示例。
屬性 說(shuō)明 type 表單類型,默認(rèn)為text name 后端接收字段名 required 必須輸入 placeholder 提示文本內(nèi)容 value 默認(rèn)指 maxlength 允許最大輸入字符數(shù) size 表單長(zhǎng)度,一般用css來(lái)控制 disabled 禁用,不可提交后端 readonly 只讀,可提交后端 accept 設(shè)置選中類型 比如:.jpg capture 使用麥克風(fēng)\視頻或攝像頭哪種方式獲取手機(jī)上傳文件,支持的值有microphone , video , camera
<form action="后端接口" method="POST">
<label for="username">用戶名</label>
<input type="text" name="username" id="username" placeholder="請(qǐng)輸入用戶名" maxlength="5" size="50" required>
</form>
當(dāng)input類型為file時(shí)手機(jī)會(huì)讓用戶選擇圖片或者拍照,如果想直接調(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)容.
類型 說(shuō)明 email 輸入內(nèi)容為郵箱 url 輸入內(nèi)容為URL地址 password 輸入內(nèi)容為密碼項(xiàng) tel 電話號(hào),移動(dòng)端會(huì)調(diào)出數(shù)字鍵盤 search 搜索框 hidden 隱藏表單 submit 提交表單 reset 重置表單 button 自定義按鈕
隱藏表單用于提交后臺(tái)數(shù)據(jù),但在前臺(tái)內(nèi)容不顯示所以在其上做用樣式定義也沒有意義.
<input type="hidden" name="id" value="1">
創(chuàng)建提交按鈕可以將表單數(shù)據(jù)提交到后臺(tái),有多種方式可以提交數(shù)據(jù),比如:AJAX,或者Html的表單按鈕.
a.使用input構(gòu)建提交按鈕,如果設(shè)置了name值,那么按鈕數(shù)據(jù)也會(huì)提交到后臺(tái),如果有多個(gè)表單項(xiàng)可以通過這些進(jìn)行判斷是哪個(gè)表單提交的.
<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屬性指定正則驗(yàn)證.
屬性 說(shuō)明 pattern 正則表達(dá)式驗(yàn)證規(guī)則 oninvalid 輸入錯(cuò)誤時(shí)觸發(fā)的事件
<form action="">
<label for="username">用戶名</label>
<input type="text" name="username" id="username" pattern="[a-z]{5,20}" oninvalid="validate('請(qǐng)輸入5~20位字母的用戶名')">
<button>提交表單</button>
</form>
<script>
function validate(message){
alert(message);
}
</script>
文本域指可以輸入多行文本的表單,當(dāng)然更復(fù)雜的情況可以使用編輯器如ueditor , ckeditor等.
屬性 說(shuō)明 cols 列字符數(shù)(一般使用css控制更好) rows 行數(shù)(一般使用css控制更好)
<textarea cols="30" rows="3">請(qǐng)踩踩我......</textarea>
下拉列表項(xiàng)可用于多個(gè)值中的選擇.
屬性 說(shuō)明 multiple 支持多選 size 列表框高度 optgroup 選項(xiàng)組 selected 選中狀態(tài) option 選項(xiàng)值
<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>
單選框指只能選擇一個(gè)選項(xiàng)的表單,如性別的選擇:男 , 女 , 保密 只能選擇一個(gè).
屬性 說(shuō)明 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ù)選框指允許選擇多個(gè)值的表單
屬性 說(shuō)明 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)的上傳功能,只是上傳效果并不是很美觀.
屬性 說(shuō)明 multiple 支持多選 accept 允許上傳類型.png , .psd 或者 image/png , image/gif
<form action="" enctype="multipart/form-data">
<input type="file">
<input type="submit" value="上傳">
</form>
屬性 說(shuō)明 min 最小時(shí)間 max 最大時(shí)間 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.日期與時(shí)間
<h1>日期與時(shí)間</h1>
<input type="datetime-local" name="" id="">
input表單的輸入值選項(xiàng)列表
<form action="">
<label for="username">用戶名</label>
<input type="text" name="" id="usernmae" list="less">
<datalist id="less">
<option value="JAVA">后臺(tái)管理語(yǔ)言</option>
<option value="CSS">美化網(wǎng)站頁(yè)面</option>
<option value="MYSQL">掌握數(shù)據(jù)庫(kù)使用</option>
</datalist>
</form>
frameset元素可定義一個(gè)框架集。它被用來(lái)組織多個(gè)窗口(框架),每個(gè)框架存有獨(dú)立的文檔,在其最簡(jiǎn)單的應(yīng)用中,frameset元素僅僅會(huì)規(guī)定在框架集中存在多少列或多少行,您必須使用cols或rows屬性。
注意事項(xiàng):由于是分割原網(wǎng)頁(yè),所以我們不能在body中進(jìn)行編寫,在head中進(jìn)行分割。
標(biāo)簽 說(shuō)明 frameset 框架集 frame 框架
屬性 說(shuō)明 cols 定義框架集中列的數(shù)目和尺寸 rows 定義框架集中行的數(shù)目和尺寸 frame border 去除框架邊框 scrolling 去除滾動(dòng)條
<!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動(dòng)物</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動(dòng)物.html" target="view">動(dòng)物圖片</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元素會(huì)創(chuàng)建包含另外一個(gè)文檔的內(nèi)聯(lián)框架。
屬性 說(shuō)明 align 對(duì)齊方式,后期采用css的方式進(jìn)行設(shè)置 width 設(shè)置寬度 height 設(shè)置高度 src 設(shè)置iframe中顯示的文檔的URL name iframe的名稱 scrolling 是否顯示滾動(dòng)條 frameborder 設(shè)置iframe的邊框
三部分 附錄(因?yàn)闀簳r(shí)不支持插入超鏈接所以部分內(nèi)容無(wú)法顯示)
附錄一 DIV命名規(guī)范
附錄二 CSS精靈
a { display:block; width:200px; height:65px; line-height:65px; /*定義狀態(tài)*/ text-indent:-2015px; /*隱藏文字*/ background-image:url(button.png); /*定義背景圖片*/ background-position:0 0; /*定義鏈接的普通狀態(tài),此時(shí)圖像顯示的是頂上的部分*/ } a:hover { background-position:0 -66px; /*定義鏈接的滑過狀態(tài),此時(shí)顯示的為中間部分,向下取負(fù)值*/ } a:active { background-position:0 -132px; /*定 義鏈接的普通狀態(tài),此時(shí)顯示的是底部的部分,向下取負(fù)值*/ }
附錄三 一些tips解決方案
頁(yè)面優(yōu)化實(shí)踐
寫DIV+CSS 的一些常識(shí)
常用代碼片段
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, button, textarea, p, blockquote, th, td { margin:0; padding:0; } body { background:#fff; color:#555; font-size:14px; font-family: Verdana, Arial, Helvetica, sans-serif; } td, th, caption { font-size:14px; } h1, h2, h3, h4, h5, h6 { font-weight:normal; font-size:100%; } address, caption, cite, code, dfn, em, strong, th, var { font-style:normal; font-weight:normal; } a { color:#555; text-decoration:none; } a:hover { text-decoration:underline; } img { border:none; } ol,ul,li { list-style:none; } input, textarea, select, button { font:14px Verdana,Helvetica,Arial,sans-serif; } table { border-collapse:collapse; } html { overflow-y: scroll; } .clearfix:after { content: "."; display: block; height:0; clear:both; visibility: hidden; } .clearfix { *zoom:1; }
<meta name=”viewport” content=”width=320,target-densitydpi=dpi_value,initial-scale=1, user-scalable=no”/>
table-layout: fixed; word-break: break-all;;border-collapse: collapse
<div id=”abc” style=”display:table;text-align:center;width:100%;height:100%;”> <span style=”background:#f00; display:table-cell; vertical-align:middle;”> <input type=”button” value=”item1″ /> </span> </div>
filter:alpha(opacity=50); /*1-100*/ -moz-opacity:0.5; /*0-1.0*/ -khtml-opacity:0.5; /*0-1.0*/ opacity:0.5; /*0-1.0*/
white-space:nowrap; text-overflow:ellipsis; overflow:hidden;
.fix{zoom:1;} .fix:after{ display:block; content:'clear'; clear:both; line-height:0; visibility:hidden; }
一些總結(jié)
一些概念
學(xué)習(xí)從來(lái)不是一個(gè)人的事情,要有個(gè)相互監(jiān)督的伙伴,想要學(xué)習(xí)或交流前端問題的小伙伴可以私信“學(xué)習(xí)”小明加群獲取2019web前端最新入門資料,一起學(xué)習(xí),一起成長(zhǎng)!
由于漢字的特殊性,在css網(wǎng)頁(yè)布局中,中文排版有別于英文排版。排版是一個(gè)麻煩的問題,小編認(rèn)為,作為一個(gè)優(yōu)秀的網(wǎng)頁(yè)設(shè)計(jì)師和網(wǎng)頁(yè)制作人員,掌握一些簡(jiǎn)單的中文排版技巧是不可或缺的,所以今天特意總結(jié)了幾個(gè)簡(jiǎn)單實(shí)用的技巧,希望對(duì)大家有所幫助。
Web前端教程
一、如何設(shè)定文字字體、顏色、大小等
font-style設(shè)定斜體,比如font-style:italic
font-weight設(shè)定文字粗細(xì),比如font-weight:bold
font-size設(shè)定文字大小,比如font-size:12px
line-height設(shè)定行距,比如line-height:150%
color設(shè)定文字顏色,注意不是font-color喔,比如color:red
font-family設(shè)定字體,比如font-family:"LucidaGrande",Verdana,Lucida,Arial,Helvetica,宋體,sans-serif
二、使用margin,text-align 控制段落
中文段落使用p標(biāo)簽,左右、段前段后的空白,都可以通過margin來(lái)控制。
比如
p{
margin:18px 6px 6px 18px;/*分別是上、右、下、左,十二點(diǎn)開始的順時(shí)針方向*/
}
而text-align則用于文字的對(duì)齊方式。
比如
p{
text-align:center;/*居中對(duì)齊*/
}
除了居中對(duì)齊之外,對(duì)齊方式還有左對(duì)齊、右對(duì)齊和兩端對(duì)齊,對(duì)應(yīng)的屬性值分別為left、right、justify。
提示:由于默認(rèn)的margin值會(huì)導(dǎo)致頁(yè)面排版出現(xiàn)問題,特別是ul、ol、p、dt、dd等標(biāo)簽。小編的解決之道就是把所有標(biāo)簽的margin值定義為0。
三、豎排文字—使用writing-mode
writing-mode屬性有兩個(gè)值lr-tb和tb-rl,前者是默認(rèn)的左-右、上-下,后者是上-下、右-左。
寫法如
p{
writing-mode:tb-rl;
}
四、使用list-style美化列表
如果我們的排版涉及到列表,不妨考慮為它添加些項(xiàng)目符號(hào)進(jìn)行美化。
在CSS里,項(xiàng)目符號(hào)包括disc(實(shí)心圓點(diǎn))、circle(空心圓圈)、square(實(shí)心方塊)、decimal(阿拉伯?dāng)?shù)字)、lower-roman(小寫羅馬數(shù)字)、upper-roman(大寫羅馬數(shù)字)、lower-alpha(小寫英文字母)、upper-alpha(大寫英文字母)、none(無(wú))。
嘿嘿!我們可用的項(xiàng)目符號(hào)數(shù)量不少喔,但美中不足的是我們不能為它們?cè)O(shè)定大小,也不能設(shè)定垂直方向上的對(duì)齊。
如果我們想設(shè)定一個(gè)列表的項(xiàng)目符號(hào)為方塊,可以這樣寫:
li{
list-style:square;
}
小編在這里提醒大家一下:當(dāng)一個(gè)項(xiàng)目列表的左外邊距設(shè)為零的時(shí)候,list-style-position:outside的項(xiàng)目符號(hào)不會(huì)顯示。
五、使用text-overflow 實(shí)現(xiàn)固定寬度漢字截?cái)?/strong>
用后臺(tái)語(yǔ)言可以對(duì)從數(shù)據(jù)庫(kù)里的字段內(nèi)容做截?cái)嗵幚恚绻雽?duì)列表應(yīng)用該樣式,我們可以這樣寫:
li{
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
}
六、首字下沉
如果你想制作首字下沉效果,不妨考慮偽對(duì)象:first-letter并配合font-size、float屬性。
p:first-letter{
padding:6px;
font-size:32pt;
float:left;
}
七、首行縮進(jìn)—使用text-indent
text-indent可以使得容器內(nèi)首行縮進(jìn)一定單位。比如中文段落一般每段前空兩個(gè)漢字。
可以這么寫
p{
text-indent:2em;/*em是相對(duì)單位,2em即現(xiàn)在一個(gè)字大小的兩倍*/
}
注意:如果font-size是12px的話,那么text-indent:2em則代表縮進(jìn)24px。
八、固定寬度漢字(詞)折行—使用word-break
在排版的時(shí)候,你是否為一個(gè)詞組,其中一個(gè)字出現(xiàn)在上面而另一個(gè)字折斷到下一行去而發(fā)愁呢?不用愁,這時(shí)使用word-break就可以輕松解決問題了。
九、關(guān)于漢字注音—使用ruby標(biāo)簽和ruby-align屬性
最后小編向大家介紹一下ruby標(biāo)簽和ruby-align屬性 。這是一個(gè)比較冷門的技巧,可能平時(shí)使用不多,但小編覺得不妨提供給大家預(yù)防不時(shí)之需。
如果我們想為漢字注音就可以這樣寫
<ruby>注音<rt style="font-size:11px;">zhuyin</rt></ruby>
然后通過ruby-align設(shè)置其對(duì)齊方式。
以上就是今日整理的“Web前端教程:簡(jiǎn)單實(shí)用的CSS網(wǎng)頁(yè)布局中文排版技巧”一文,希望為正在學(xué)習(xí)Web前端的同學(xué)提供參考。你記住并理解了嗎?以后酷仔每日均會(huì)提供MySQL、Python及Web相關(guān)的教程及習(xí)題,趕快學(xué)習(xí)起來(lái)吧。
*請(qǐng)認(rèn)真填寫需求信息,我們會(huì)在24小時(shí)內(nèi)與您取得聯(lián)系。