在網頁設計作業制作過程中,很多時候我們遇到Form表單,左邊是文字標題,右邊是表單input空,對于新手來說是非常麻煩的事,接下來STU網頁設計教大家用CSS實現表單form布局。
HTML示例
<form action="" method="post">
<label for="user">姓名:</label>
<input type="text" id=user name="user" value="" /><br />
<label for="email">郵件:</label>
<input type="text" id=email name="email" value="" /><br />
<label for="comment">備注:</label>
<textarea id=comment name="comment">
</textarea><br />
<input type="submit" id="sbutton" value="確定" /><br />
</form>
|
CSS代碼示例
<style type="text/css">
<!--
label{float: left;width: 80px;line-height:25px;}
form{margin:0px}
input{width: 180px;border:1px solid #808080;}
textarea{width: 250px;height: 150px;}
#sbutton{margin-left: 80px;margin-top: 5px;width:80px;}
br{clear: left;}
-->
</style>
|
另外CSS代碼中還可以根據自己的要求美化表單框及按鈕。