15-02-14 HTML

來源:互聯網
上載者:User

標籤:

HTML 超文字標記語言 (HTML),在HTML當中存在著大量的標籤,我們用HTML提供的標籤,將要顯示在網頁中的內容包含起來,就構成了 我們的網頁;

網頁中有什麼東西,由HTML決定,這些內容長成什麼樣子由CSS決定;

HTML僅僅是用來控制網頁的,網頁長什麼樣,由CSS決定;

HTML+CSS構成了我們看到的漂亮的網頁;CSS控制網頁內容顯示的效果;

HTML+CSS做出來的是靜態網頁;靜態網頁,沒有什麼效果,就一個展示的功能;

JS+JQuery能使網頁有動態效果;

<html>

<head>

<title></title>

</head>

<body>

</body>

</html>

HTML是不區分大小寫語言; 要將內容顯示在網頁上,就寫在body標籤中,

<p></p>段落標籤;

&nbsp空格標籤; 

在HTML按很多歌空格鍵只會有一個空格,要使空格增多,就必須加&nasp;

<h#></h#> #1-6 標題標籤,h1最大;

<img src = "C:\....."  width="200px" heigth ="200px" border = "1px" alt="原來是美女呀" title="還行吧"/> 映像標籤,

HTML中屬性是以屬性名稱="值"的形式;,屬性與屬性之間通過一個空格隔開;

<!-- 要注釋的內容 --> html注釋符;

alt:當圖片由於某些原因顯示失敗的時候所顯示的文本

title:當游標移動到圖片上的時候顯示的文本;

html元素有始有終;html可以嵌套

<hr/> 水平分割線; 

 用p標籤來換行,那麼行與行之間有間隙,用br來換行,行與行之間不會有間隙;

> (&gt)   <(&lt)  &(&amp)  空格(&nbsp)

屬性的值建議用引號括起來;屬性建議均以索引值對的形式括起來,一個標籤可有多個屬性,用空格分開;

<font size="7" color="red" face="仿宋">1</font>  字型標籤。size=7是最大的,face字型系列

<b></b>加粗  <i></i>斜體  <tt></tt>打字機類型   <u>底線</u>    <s>刪除線</s>  <sup></sup>上標  <sub></sub>下標

<pre></pre>標籤相當於C#的@符號,怎麼編輯,怎麼列印

<marquee direction ="right"  behavior="slide" ></marquee> 用來顯示元素的移動 direction向哪個方向移動,

<a href="http://www.baidu.com" target="_blank">百度</a> 超連結 href表示要連結到的地址 target開啟新網頁的方式 target="_blank"在新的頁面上開啟連結, 不加這個的話在原來頁面上跳轉   target="_self"在原來頁面上跳轉

<a></a>實現頁面內部的跳轉; <a name = "dingduan" href = "#diduan"></a>

通過一個頁面 <a name = "diduan"   href = "a.html#dingduan“></a>  可以跳到其他頁面  其實就是標籤與標籤之間的跳轉;

<a href="mailto:[email protected]"></a>   <a></a>標籤還可以發送郵件

不只文字可以超連結,圖片也可以 <a href = "#"></a> 是超連結,但是不會跳轉;

<body text="green" link="pink" alink="black" vlink="green"  bgcolor="pink" background="1.jpg" >  //text body中的文本顏色  link body中超連結的顏色  alink body中超連結按下時候的顏色  vlink body中超連結按過後的顏色 bgcolor body中背景顏色 background body中背景圖片; </body>

<ul type = "disk"> //type指的是前面的類型 <li></li> 列表中的每一項 </ul>無序列表

<ol type = "a"> //type指的是從什麼開始,預設是1開始的; <li></li> </ol>有序列表

<dl>

<dt></dt>

<dd></dd>

<dd></dd>

<dd></dd>

<dt></dt>

<dd></dd>

<dd></dd>

<dd></dd>

<dd></dd>

</dl>

<table border="1" cellspacing="0px" cellpadding="5px">

<tr>    

<td>儲存格內容</td>

</tr>

<tr>   

 <td>儲存格內容</td>

</tr>

</table>

cellspacing 儲存格與儲存格之間的距離

cellpadding 文字離邊框的距離;

在<table>中行數列數要數多的;

<html>

<head>

<title></title>

</head>

<body>

<table border="1px" cellspacing="0px" cellpadding="0px" >

<tr>

<td colspan="2">學產生績</td>

</tr>

<tr>

<td>語文</td>

<td>98</td>

</tr>

<tr>

<td>數學</td>

<td>95</td>

</tr>

</table>

</body>

</html>

儲存格跨列用colspan屬性來實現 

<html>

<head>

<title></title>

</head>

<body>

<table border="1px" cellspacing="0px" cellpadding="0px" height="100px" width="280">

<tr>

<td rowspan="2">張三</td>

<td>語文</td>

<td>98</td>

</tr>

<tr>

<td>數學</td>

<td>95</td>

</tr>

<tr>

<td rowspan="2">李四</td>

<td>語文</td>

<td>88</td>

</tr>

<tr>

<td>數學</td>

<td>95</td>

</tr>

</table>

</body>

</html>

儲存格跨行用rowspan屬性來實現

 

<html>

<head>

<title></title>

</head>

<body>

<table border="1px" cellspacing ="0px" cellspadding="0px" height ="100px" weight = "100px">

<tr>

<td><font color = "blue">手機儲值,IC卡</font></td>

<td colspan="3"><font color = "blue">手機儲值,IC卡</font></td>

</tr>

<tr>

<td rowspan = "3">各種卡的總匯</td>

<td>鉛筆</td>

<td>鉛筆</td>

<td>鉛筆</td>

</tr>

<tr>

<td>鉛筆</td>

<td>鉛筆</td>

<td>鉛筆</td>

</tr>

<tr>

<td>鉛筆</td>

<td>鉛筆</td>

<td>鉛筆</td>

</tr>

</table>

</body>

</html>

如果看到表格中的加粗的,可以把它的<td></td>換為<th></th>,<th>是表格的標題;

<html>

<head>

<title></title>

</head>

<body>

<table border="1px" cellspacing="0px" cellpadding="0px" height="100px" width="280">

<tr>

<th colspan="3" >學生基本情況</th>

</tr>

<tr>

<th>姓名</th>

<th>性別</th>

<th>專業</th>

</tr>

<tr>

<td>劉備</td>

<td>男</td>

<td rowspan = "3">計算機</td>

</tr>

<tr>

<td>孫尚香</td>

<td>女</td>

</tr>

<tr>

<td>諸葛亮</td>

<td>男</td>

</tr>

</table>

</body>

</html>

<table></table>的屬性bgcolor border bordercolor cellspacing cellpadding width height

<td></td>的屬性 align valign colspan rowspan width height bgcolor

align : left center right    控制文本在儲存格中的左中右位置

valign : top middle botton    控制文本在儲存格中的上中下位置

設定網頁中元素的外觀,我們會用CSS

在網頁中使用表單的作用就是向伺服器傳輸資料;<form></form> HTML表單是用於搜集使用者輸入的,HTML表單都擴在一對<form>標籤中,

<form>的常用屬性 action 表示提交的目標伺服器 method 提交的方法get post get預設,(以url提交,就是以地址欄的方式提交) post通過報文提交;

表單裡面的元素全是input標籤,只不過類型不一樣,

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

<input type ="password" name = "txtPwd"/>

<input type ="submit" value = "提交">

<input type = "reset" value= "重設">

<fieldset>

<legend>性別</legend>

<input type ="radio" name="sex"/>男<br/>

<input type ="radio" name="sex"/>女<br/>

</fieldset>

<fieldset>

<legend>婚姻狀況</legend>

<input type ="radio" name="married"/>已婚<br/>

<input type ="radio" name="married"/>未婚<br/>

</fieldset>

wiform後台拿到前面空間的對象,通過name去拿;html也是一樣,要設定一個name屬性; <fieldset>能分成一個一個地區;

<select>

<optgroup label="河北省">

<option>1</option>

<option>2</option>

<option>3</option>

<option>4</option>

</optgroup>

<optgroup label="河南省">

<option>1</option>

<option>2</option>

<option>3</option>

<option>4</option>

</optgroup>

<optgroup label="湖北省">

<option>1</option>

<option>2</option>

<option>3</option>

<option>4</option>

</optgroup>

<optgroup label="湖南省">

<option>1</option>

<option>2</option>

<option>3</option>

<option>4</option>

</optgroup>

</select>

<select></select>相當於combox

<input type = "file">

<textarea cols = "20" rows = "3">  </textarea> 文本域

 <html>

<head>

<title></title>

</head>

<body>

<form action="http://www.baidu.com" method="get">

<table border="1px" cellspadding = "0px"  cellspacing="0px">

<tr>

<td>使用者名稱</td>

<td><input type="text" name="txtName"/></td>

</tr>

<tr>

<td>密碼</td>

<td><input type="password" name="txtPwd"/></td>

</tr>

<tr>

<td>驗證碼:</td>

<td><input type = "text" name="txtJudge"/><img src="image1.jpg"></td>

</tr>

<tr>

<td></td>

<td><input type = "checkbox" name="txtRem"/>記住密碼</td>

</tr>

<tr>

<td></td>

<td><input type = "submit"/><input type = "reset"/> 記住密碼</td>

</tr>

</table>

</form>

</body>

</html>

給網站布局div比table更為好用;

div標籤獨佔一行;span標籤不獨佔一行;

<html>

<head>

<title></title>

</head>

<body>

<div style="background:red;height:50px;width:300px">我是一個div</div>

<span>哈哈哈哈</span>

</body>

</html>

一般對文本設定樣式的時候一般都扔到span裡面去,span標籤專門修飾文本,在布局的時候用到div

<html>

<head>

<title>左邊的頁面</title>

</head>

<body bgcolor="pink">

<a href = "www.mop.com" target="Right">貓撲</a>

<a href = "www.dapengti.com" target="Right">打噴嚏</a>

<a href = "www.cnbeta.com" target="Right">cnbeta</a>

<a href = "www.51aspx.com" target="Right">51aspx</a>

</body>

</html>

left.html

<html>

<head>

<title>右邊的頁面</title>

</head>

<body bgcolor="green">

i‘m right

</body>

</html>

right.html

<html>

<head>

<title>上邊的頁面</title>

</head>

<body bgcolor="yellow">

i‘m top

</body>

</html>

作為架構頁面的承載頁面是不允許有<body>標籤的,用<frameset></frameset>來代替;

 

<html>

<head>

<title></title>

</head>

<frameset rows="15%,*">  

     <frame src="top.html"  noresize="noresize"/>

        <frameset cols="30%,*">  

            <frame src="left.html"  noresize="noresize"/>   

            <frame src="right.html" name = "Right" />

        </frameset>

   </frameset>

</html>

裡面的頁面也可以作為承載頁;

 

15-02-14 HTML

聯繫我們

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