本文總結(jié)了用div css進(jìn)行網(wǎng)頁表單布局的五個(gè)小技巧可以幫助你更靈活的控制表單,使頁面更加滿意。
1、表單文本輸入的移動選擇:
在文本輸入欄中,如果加入了提示,來訪者往往要用鼠標(biāo)選取后刪除,再輸入有用的信息。其實(shí)只要加入onmouseover="this.focus()" onfocus="this.select()" 代碼到 <textarea> 中,一切就會變得簡單多了,如:
<textarea name=textarea wrap=virtual rows=2 cols=22 onmouseover="this.focus()" onfocus="this.select()">input english..</textarea>
類似的,可以加入代碼到<input>。
2、表單輸入單元點(diǎn)擊刪除:
本列同上則作用類似,只是使用鼠標(biāo)上略有變化,需要點(diǎn)擊而不像上則的只要鼠標(biāo)覆蓋。如:
<input type=text name="address" size=19 value="enter,e-mail..."onfocus="this.value=''">
點(diǎn)擊輸入單元后,提示信息會刪除,是不是很方便。
3、表單輸入單元的邊框設(shè)置:
更改傳統(tǒng)的表單單元邊框,會讓你的主頁生色不少。如:
<input type=radio name=action value=subscribe checked style="border-bottom: dashed 1px; border-left: dashed 1px; border-right: dashed 1px; border-top: dashed 1px;background-color: #fef5c8">
其中"style=***"為左右上下和背景色設(shè)置,適用于其它單元,請讀者親自試試。
4、表單輸入單元的文字設(shè)置:
表單中單元的字體是可以修改的,如:
<input type=text name="address" size=19 value="enter,e-mail..." style=font-family:"verdana";font-size:10px >
其中"style=***"為字體和字大小設(shè)置。
5、修改表單屬性為彈出窗口:
大多數(shù)表單激活后,會在當(dāng)前頁面中打開,影響正常瀏覽。不如修改一下,如:
<form method=post action=url target=_blank>
其中"target=_blank"為控制在彈出窗口打開。
新聞熱點(diǎn)
疑難解答
圖片精選