CSS 表单
输入框前有图片
老板让你实现在输入框前有图片的功能。老板觉得用图片代替文字更有说服力。

要实现这样的功能很简单,它的原理是将图片放在内边距内。
代码
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<!DOCTYPE html><html> <head> <title>表单输入组件样式</title> <style type="text/css"> input { font-size: 120%; color: #5a5854; border: 1px solid #bdbdbd; border-radius: 5px; padding: 5px 5px 5px 30px; background-repeat: no-repeat; background-position: 8px 9px; display: block; margin-bottom: 10px;} input:focus, input:hover { border: 1px solid #b1e1e4;} input#email { background-image: url("email.png");} input#twitter { background-image: url("twitter.png");} input#web { background-image: url("web.png");} </style> </head> <body> <h1>软件开发,成就梦想</h1> <form> <input type="text" id="email" /> <input type="text" id="twitter" /> <input type="text" id="web" /> </form> </body></html> |
源码下载

表单组件排版
未经美化的HTML表单通常是这个鬼样子。

这样的效果自然不好看,下面的代码对表单进行美化。
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
<!DOCTYPE html><html> <head> <title>单选按钮对齐</title> <style type="text/css"> div { margin: 10px; padding-bottom: 10px; max-width:360px; } .title { float: left; width: 100px; text-align: right; padding-right: 10px;} .submit { text-align: right;} </style> </head> <body> <h1>软件开发,成就梦想</h1> <form method="post"> <div> <label for="name" class="title">用户名:</label> <input type="text" id="name" name="name" /> </div> <div> <label for="password" class="title">密码:</label> <input type="password" id="password" name="password" /> </div> <div> <span class="title">性别:</span> <input type="radio" name="gender" id="male" value="M" /> <label for="male">男</label> <input type="radio" name="gender" id="female" value="F" /> <label for="female">女</label><br /> </div> <div class="submit"> <input type="submit" value="提交" id="submit" /> </div> </form> </body></html> |

关键技术:
1、对每一行(标签和输入框组件)限制长度 max-width:360px;
2、对【性别】进行左边浮动,它的文本进行右对齐。
光标样式
cursor 属性有不同的值,这些值让光标显示不同的形状。
常见的形状有:
| 属性值 | 说明 |
| default | 默认光标,通常是一个箭头 |
| auto | 浏览器自动识别的光标 |
| crosshair | 十字线 |
| pointer | 手型指针 |
| move | 移动指针 |
| text | 文本指针 |
| wait | 指示程序正忙 |
| col-resize | 双向移动 |
| help | 帮助指针 |
示例
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
<!DOCTYPE html><html> <head> <title>单选按钮对齐</title> <style type="text/css"> a{display:block} a.aut{cursor:auto} a.crosshair{cursor:crosshair} a.default{cursor:default} a.pointer{cursor:pointer} a.move{cursor:move} a.text{cursor:text} a.wait{cursor:wait} a.help{cursor:help} </style> </head> <body> <h1>软件开发,成就梦想</h1> <a class="auto">auto</a> <a class="crosshair">crosshair</a> <a class="default">default</a> <a class="pointer">pointer</a> <a class="move">move</a> <a class="text">text</a> <a class="wait">wait</a> <a class="help">help</a> </body></html> |

CSS 表单的更多相关文章
- js 节点 document html css 表单节点操作
js 节点 document html css 表单节点操作 节点操作:访问.属性.创建 (1)节点的访问:firstChild.lastChild.childNodes.parentChild(父子 ...
- CSS表单设计
今天我们开始学习<十天学会web标准(div+css)>的css表单设计,包含以下内容和知识点: 改变文本框和文本域样式 用图片美化按钮 改变下拉列表样式 用label标签提升用户体验 一 ...
- Web标准:九、CSS表单设计
Web标准:九.CSS表单设计 知识点: 1.改变文本框和文本域样式 2.用图片美化按钮 3.改变下拉列表样式 4.用label标签提升用户体验 1)改变文本框和文本域样式 文本框标签:<i ...
- css 表单标签两端对齐
来自:http://demo.doyoe.com/css3/justify/justify-form.htm 侵删 <!DOCTYPE html> <html lang=" ...
- bootstrap -- css -- 表单控件
若干css样式 .form-control { display: block; width: 100%; height: 34px; padding: 6px 12px; font-size: 14p ...
- 什么是CSS 表单?
㈠输入框(input) 样式 ⑴使用 width 属性来设置输入框的宽度 示例:css部分:input { width: 100%; } html部分:<for ...
- CSS表单与数据表(下)
2.表单 表单是用户输入内容的地方.表单涉及的控件很多,而且一直很难给它们应用样式.无法控制样式的部分,可以通过自定义控件来解决. 2.1 简单的表单 2.1.1 fieldset与legend fi ...
- CSS表单与数据表(上)
表单在现代Web应用中占据着重要地位. 表单可以很简单,也可以非常复杂,要横跨几个页面. 除了从用户哪里获得数据,Web应用还需要以容易看懂的方式展示数据.表格是展示复杂数据的最佳方式. 1.设计数据 ...
- Bootstrap CSS 表单
表单布局 Bootstrap 提供了下列类型的表单布局: 垂直表单(默认) 内联表单 水平表单 垂直或基本表单 基本的表单结构是 Bootstrap 自带的,个别的表单控件自动接收一些全局样式.下面列 ...
随机推荐
- Quartz动态修改数据库cronExpression(无须重启服务器即可更改定时时间)
quartz通过动态设置配置文件确实可以实现与数据库的同步,但现实开发上线后我们基本是不会对配置文件等进行变动,因为重启一次服务器所需的成本太多. 这时,就需要我们仅仅修改数据库就能实现动态的更新定时 ...
- 2018年4月中旬的PTA(三)
C高级第三次PTA作业(1) 题目6-1 输出月份英文名 1.设计思路 (1)算法(子函数) 第一步:定义字符型一级指针子函数名getmonth,形参整型n. 第二步:定义长度为12的字符数组指针mo ...
- springboot中get post put delete 请求
组合注解(RequestMapping的变形) @GetMapping = @RequestMapping(method = RequestMethod.GET) @PostMapping = @Re ...
- 2019西湖论剑网络安全技能大赛(大学生组)--奇怪的TTL字段(补充)
鉴于有人不会将得到的16进制数据在winhex中转成图片,我在这里写一个详细的步骤. 首先就是将六张图片的十六进制数据找出并提取出来. 打开winhex,新建一个文档. 大小可以选1bytes 将数据 ...
- Go并发编程实战 (郝林 著)
第1章 初识Go语言 1.1 语言特性 1.2 安装和设置 1.3 工程构造 1.3.1 工作区 1.3.2 GOPATH 1.3.3 源码文件 package main import ( " ...
- esxi5 的tart命令使用注意点
esxi5.0 注意tar命令参数使用和centos6稍微有点不一样,注意下 注意需要把-f参数单独分离出来,紧接着文件. 而不能和cz命令一起用 ~ # touch abc.txt ~ # ec ...
- centos 7 su jenkins 切换不过去
root切换到jenkins用户: passwd jenkins:设置jenkins用户密码 su jenkins : 切换不过去, 查看passwd文件 cat /etc/passwd 找到:jen ...
- Android手机上Audio DSP频率低 memory小的应对措施
我在前面的文章(Android智能手机上的音频浅析)中说过Android手机上有一块专门用于音频处理的DSP,它的特点是频率低(一般几百MHZ).内部memory小(通常不超过100k word).要 ...
- node升级的正确方法
本文主要是针对安装了node的用户如何对node进行升级或者安装指定版本:没有安装node的可以参考连接node安装方法 . 安装方法: 1.产看node版本,没安装的请先安装: $ node -v ...
- linux git pull/push时提示输入账号密码之免除设置
1.先cd到根目录,执行git config --global credential.helper store命令 [root@iZ25mi9h7ayZ ~]# git config --global ...