html標籤optgroup和sub以及sup和bdo範例程式碼

黄舟
發布: 2017-07-03 09:34:11
原創
1339 人瀏覽過

HTML標籤之optgroup、sub、sup和bdo的用法與範例程式碼,需要的朋友可以參考下。 optgroup 用在select 標記中可以使下拉列表內容更加有條理

<select>
<optgroup label="aaa">
<option>分清是非</option>
<option>分清是非</option>
<option>分清是非</option>
</optgroup>
<optgroup style="color:#C30" label="bbb">
<option>分清是非</option>
<option>分清是非</option>
<option>分清<br/>是非</option>
</optgroup>
</select>
登入後複製


sub 上標
sup 下標可與註解
dbo dir 標記一起使用,可以改變文字的輸出方向,右->左

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>4个不常用HTML标签optgroup、sub、sup和bdo。</title>
<style type="text/css">
fieldset{width:300px;padding:5px 5px;  margin:30px auto; display:block; line-height:125%; font-size:15px;}
legend{margin-left:15px; font-size:18px; color:red; }
bdo{color:red;}
</style>
</head>
<body>
<fieldset><legend>optgroup</legend>
<select>
<optgroup label="HTML标记">
<option>table</option>
<option>tr</option>
<option>td</option>
<option>th</option>
</optgroup>
<optgroup label="ASP内置对象">
<option>cookies</option>
<option>session</option>
<option>application</option>
<option>redirect</option>
</optgroup>
</select>

<select>
<optgroup label="">
<option>....</option>
</optgroup> 
</select>
</fieldset>
<fieldset class="sub">
<legend>sub标记</legend>
X<sub>2</sub> 上标 X<sub>2</sub>
X<sup>2</sup> 下标 X<sup>2</sup>
<hr />
与<em>标签结合可以用于注释,例:
flying<sub><em>注:HTML XHTML网页编码 版主</em></sub>
</fieldset>
<fieldset><legend>bdo标记</legend>
<bdo dir="ltr">我非常爱你</bdo>
<bdo dir="rtl">你爱常非我</bdo>
输出结果为  
<bdo dir="ltr">我非常爱你</bdo>
<bdo dir="rtl">你爱常非我</bdo>
注:使用bod标签时必须连用dir标签属性,ltr指从左到右的编排顺序,rtl指从右到左的编排顺序。
</p>
</p>
</fieldset>
</body>
</html>
登入後複製

提示:您可以先修改部分程式碼再執行

以上是html標籤optgroup和sub以及sup和bdo範例程式碼的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!