CSS布局表单
来源:互联网 发布:农民战争 知乎 编辑:程序博客网 时间:2024/04/28 14:37
The CSS:
<style type="text/css">
label{
float: left;
width: 120px;
font-weight: bold;
}
input, textarea{
width: 180px;
margin-bottom: 5px;
}
textarea{
width: 250px;
height: 150px;
}
.boxes{
width: 1em;
}
#submitbutton{
margin-left: 120px;
margin-top: 5px;
width: 90px;
}
br{
clear: left;
}
</style>
The HTML:
<form>
<label for="user">Name</label>
<input type="text" name="user" value="" /><br />
<label for="emailaddress">Email Address:</label>
<input type="text" name="emailaddress" value="" /><br />
<label for="comments">Comments:</label>
<textarea name="comments"></textarea><br />
<label for="terms">Agree to Terms?</label>
<input type="checkbox" name="terms" class="boxes" /><br />
<input type="submit" name="submitbutton" id="submitbutton" value="Submit" />
</form>
By floating the "label" tag to the left, the text description of each form field appears to the left, resulting in a "two column" look for the form. The width of the "label" is controlled, so it will comfortably contain the longest text description in the form. I throw in a <br> tag with "clear: left" after each form field to prevent the floating <label> tag from potentially spilling over to content beneath it. Margins such as "margin-top" and "margin-bottom" are also used to add some nice margins between form fields.
- CSS布局表单
- CSS 简洁表单布局
- BootStrap--CSS布局--表单
- 经典用CSS实现form表单布局
- 用CSS布局表单实例(抛弃表格)
- 一个清新的CSS表单布局
- div+css表单布局技巧(个人留存
- div css表单布局技巧方法
- 一个清新的CSS表单布局
- div css表单布局的五个小技巧
- Web界面设计学习笔记(2):css表单布局
- div css表单布局的五个小技巧
- css表单
- Css 表单
- css布局
- css布局
- css布局
- css-布局
- 快速上手Spring--3. 加载Bean的配置文件
- 软件需求说明书(转载)
- Dashed Vertical Menu
- EJB的七年之痒
- 将Java程序作成exe文件的几种方法
- CSS布局表单
- exe4j应用体会(摘)
- C#入门代码集
- 10进制 -〉 2-16进制的转换
- 几种常见的排序方法
- 监视光标的程序(摘选存档)
- 引言,将来会写些什么文档
- JBuilder 2005 Struts深度体验
- 郁闷的Layer动画