HTML5 <fieldset> 標(biāo)簽

2022-05-23 14:53 更新

實(shí)例

HTML5 <fieldset>標(biāo)簽用于對(duì)表單中的相關(guān)元素進(jìn)行分組:

<form>
 <fieldset>
   <legend>Personalia:</legend>
   Name: <input type="text"><br>
   Email: <input type="text"><br>
   Date of birth: <input type="text">
 </fieldset>
</form> 
嘗試一下 ?

瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主流瀏覽器都支持 <fieldset> 標(biāo)簽。


標(biāo)簽定義及使用說(shuō)明

<fieldset> 標(biāo)簽可以將表單內(nèi)的相關(guān)元素分組。

<fieldset> 標(biāo)簽會(huì)在相關(guān)表單元素周圍繪制邊框。


提示和注釋

提示:<legend> 標(biāo)簽為 <fieldset> 元素定義標(biāo)題。


HTML 4.01 與 HTML5之間的差異

HTML5 中新增了一些 <fieldset> 的新屬性:disabled、form、name,HTML 4.01 中不支持這些屬性。


屬性

New :HTML5 中的新屬性。

屬性 描述
disabledNew disabled 規(guī)定該組中的相關(guān)表單元素應(yīng)該被禁用。
formNew form_id 規(guī)定 fieldset 所屬的一個(gè)或多個(gè)表單。
nameNew text 規(guī)定 fieldset 的名稱。


全局屬性

<fieldset> 標(biāo)簽支持 HTML 的全局屬性。


事件屬性

<fieldset> 標(biāo)簽支持 HTML 的事件屬性。

以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)