HTML學習基礎(二)

來源:互聯網
上載者:User

標籤:

一、表格(table)標籤

1、定義:

<table> 標籤定義 HTML 表格。

簡單的 HTML 表格由 table 元素以及一個或多個 tr、th 或 td 元素組成。

tr 元素定義表格行,th 元素定義表頭,td 元素定義表格單元。

更複雜的 HTML 表格也可能包括 caption、col、colgroup、thead、tfoot 以及 tbody 元素。

2、文法:

 1 <table> 2   <tr> 3     <th>Month</th> 4     <th>Savings</th> 5   </tr> 6   <tr> 7     <td>January</td> 8     <td>$100</td> 9   </tr>10 </table>

3、可選屬性:

 

二、img標記

1、定義

img 元素向網頁中嵌入一幅映像。

<img> 標籤並不會在網頁中插入映像,而是從網頁上連結映像。<img> 標籤建立的是被引用映像的佔位空間。

<img> 標籤有兩個必需的屬性:src 屬性 和 alt 屬性。

2、樣本

<img src="../../ch6/Dir2/sea.gif"/>

 

3、效果

4、屬性

屬性

含義

height

高度

width

寬度

border

邊框寬度

lowsrc=“低解析度圖片的位置”

當網路傳輸阻塞時,強迫瀏覽器先讀取低解析度的圖片

alt

當瀏覽器不能顯示所指代的圖片時,可以設定IE顯示一段說明該圖片的文字,代替圖檔案。要看效果必須進行的設定:internet選項----取消勾選多媒體項目的顯示圖片複選框---確定

 

 

 

 

 

 

 

 

 

 

 

 

5、全屏平鋪圖片

說明:根據瀏覽器的大小變動,背景圖片充滿整個瀏覽器。

<img src="../../ch6/Dir2/sea.gif" width="100%" height="100%" style="z-index:100;position:absolute;left:0;top:0;"/>

 

三、超連結

1、相對路徑和絕對路徑

2、超連結標記

 <a href=”連結位置”>超連結名稱</a>

 

3、圖片超連結

<a href="http://www.baidu.com"><img src=../images/xujun.jpg></a>

 

四、HTML表單

1、HTML

<form>    <table border="1">        <tr><td>姓名:</td><td><input type="text" /></td></tr>        <tr><td>學號:</td><td><input type="text" /></td></tr>        <tr><td>密碼:</td><td><input type="password" /></td></tr>        <tr><td>省份:</td><td>        <select>            <option>---請選擇---</option>            <option>北京</option>            <option>天津</option>            <option>上海</option>            <option>浙江</option>            <option>江蘇</option>        </select>        </td></tr>        <tr><td>性別:</td><td>            <input type="radio" name="sex" id="m"/><label for="m">男</label>            <input type="radio" name="sex" id="w" /><label for="w">女</label>        </td></tr>        <tr><td colspan="2" align="center" valign="middle"><input type="submit" value="提交" /></td></tr>    </table></form>

 

2、select標籤,多選屬性

如果要變成複選,加muiltiple即可。使用者用Ctrl來實現多選。

<select name="fruit" multiple="multiple">

 

還可以用size屬性來改變下拉框(Select)的大小

 

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.