可咔酷-网络杂货铺

用CSS实现表单form布局

在TABLE布局中设计Form,一般都是用2个td来布局,如果不用table,用CSS怎么做呢?看看下面的代码:

  1. <style type="text/css">
  2. label{float: left;width: 80px;}
  3. form{margin:0px}
  4. input{width: 180px;border:1px solid #808080}
  5. textarea{width: 250px;height: 150px;}
  6. #sbutton{margin-left: 80px;margin-top: 5px;width:80px;}
  7. br{clear: left;}
  8. </style>
  9. <form action="" method="post">
  10. <label for="user">姓名:</label><input type="text" id=user name="user" value="" /><br />
  11. <label for="email">邮件:</label><input type="text" id=email name="email" value="" /><br />
  12. <label for="comment">备注:</label><textarea id=comment name="comment"></textarea><br />
  13. <input type="submit" id="sbutton" value="确定" /><br /></form>
  • 25个免费的WordPress图片相册幻灯插件
  • 13个令人惊奇的HTML5和CSS3应用实例
  • IE6 很邪恶,但我爱它的盒子模型
  • [转]三言二拍:营销的会与技术的会

发表评论