首页
网页制作
网络编程
脚本专栏
数据库
网站运营
网络安全
平面设计
CMS教程
搜索
建站极客
网页制作
CSS
正文
表单label美化代码
所属分类:
网页制作
/
CSS
阅读数: 1319
收藏 0
赞 0
分享
化表单,效果如下:
每个lebal有箭头的背景
有焦点的lebal背景高亮
示例如下:
代码如下:
复制代码
代码如下:
<form id="commentform" method="post" action="">
<p class="input"><label for="author">姓 名</label><input type="text" aria-required="true" tabindex="1" size="12" value="" id="author" name="author"></p>
<p class="input">
<label for="email">邮 件</label><input type="text" aria-required="true" tabindex="2" size="12" value="" id="email" name="email"></p>
<p><input type="submit" value="提交评论" tabindex="5" id="submit" name="submit"></p>
</form>
css代码:
复制代码
代码如下:
#commentform{
font-size:12px;
}
#commentform label{width:55px;height:24px;display:block;float:left;background:url(label.png) no-repeat left top;line-height:22px;color:#999;padding-left:18px;}
* html #commentform label{float:none;display:inline;padding:5px 15px 10px 18px;margin-right:10px;vertical-align:middle;}
#commentform input{height:20px;width:220px;border:1px solid #EEE;padding:4px 4px 0 4px;}
#commentform p.input:hover label,#commentform p.input:active label,#commentform p.input:focus label{
background:url(label.png) no-repeat left -40px;color:#000;
}
#commentform input#submit{width:82px;height:24px;background:url(submit.png) no-repeat left top;margin-left:73px;color:#999;border:0 none;line-height:100%;display:block;padding:0;cursor:pointer;}
#commentform input#submit:hover,#commentform input#submit:active,#commentform input#submit:focus{background:url(submit.png) no-repeat left bottom;color:#000;}
完整测试代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>label 美化</title> <style type="text/css"> #commentform{ font-size:12px; } #commentform label{width:55px;height:24px;display:block;float:left;background:url(//img.jbzj.com/demoimg/201005/label.png) no-repeat left top;line-height:22px;color:#999;padding-left:18px;} * html #commentform label{float:none;display:inline;padding:5px 15px 10px 18px;margin-right:10px;vertical-align:middle;} #commentform input{height:20px;width:220px;border:1px solid #EEE;padding:4px 4px 0 4px;} #commentform p.input:hover label,#commentform p.input:active label,#commentform p.input:focus label{ background:url(//img.jbzj.com/demoimg/201005/label.png) no-repeat left -40px;color:#000; } #commentform input#submit{width:82px;height:24px;background:url(//img.jbzj.com/demoimg/201005/submit.png) no-repeat left top;margin-left:73px;color:#999;border:0 none;line-height:100%;display:block;padding:0;cursor:pointer;} #commentform input#submit:hover,#commentform input#submit:active,#commentform input#submit:focus{background:url(//img.jbzj.com/demoimg/201005/submit.png) no-repeat left bottom;color:#000;} </style> </head> <body> <form id="commentform" method="post" action=""> <p class="input"><label for="author">姓 名</label><input type="text" aria-required="true" tabindex="1" size="12" value="" id="author" name="author"></p> <p class="input"> <label for="email">邮 件</label><input type="text" aria-required="true" tabindex="2" size="12" value="" id="email" name="email"></p> <p><input type="submit" value="提交评论" tabindex="5" id="submit" name="submit"></p> </form> </body> </html>
提示:您可以先修改部分代码再运行
请注意图片的地址。
更多精彩内容
其他人还在看
2013年五大主流浏览器 HTML5 与 CSS3 兼容性大比拼
这篇文章主要介绍了2013年五大主流浏览器 HTML5 和 CSS3 兼容性大比拼,需要的朋友可以参考下
评论 0
收藏 0
赞 0
分享
前端设计师需要了解的9个问题
这篇文章主要介绍了前端设计师需要了解的9个问题以及注意事项,非常的实用,是篇非常不错的文章,这里推荐给大家
评论 0
收藏 0
赞 0
分享
CSS强制性换行的方法区别详解
自动换行问题,正常字符的换行是比较合理的,而连续的数字和英文字符常常将容器撑大,挺让人头疼,下面介绍的是CSS如何实现换行的方法对于div,p等块级元素正常文字的换行(亚洲文字和非亚洲文字)元素拥有默认的white-space:normal,当定义的宽度之后自动换行
评论 0
收藏 0
赞 0
分享
CSS语义化命名方式及常用命名规则
本文搜集了一些CSS语义化命名方式以及命名规则。如有错误或不妥之处,敬请指出,欢迎你提出更好的建议,加插更多的命名规范。
评论 0
收藏 0
赞 0
分享
ul li内容宽度的问题的解决方案
在IE6下只要我设置LI的宽度为auto,不论LI里面的内容多长,LI的宽度始终是100%,即UL的宽度(这里我已经写死了UL的宽度)。设置max-width也没用。高手们,在IE系列浏览器中如何使LI的宽度真正的随着内容增长而增长呢?像FF那样。
评论 0
收藏 0
赞 0
分享
html5+css3气泡组件的实现
本文是html5+css3系列教程的第一篇,给大家讲述html5+css3实现气泡组件,讲解的十分的详细,这里推荐给大家,希望对大家能有所帮助
评论 0
收藏 0
赞 0
分享
html5+css3之CSS中的布局与Header的实现
本文从CSS3的布局(CSS的布局的演化、CSS3盒模型-box-sizing、float布局中的bfc、Flexbox简介)Header布局的实现(float实现布局、Header js的实现)向我们展示了HTML5与CSS3的魅力。
评论 0
收藏 0
赞 0
分享
一款恶搞头像特效的制作过程 利用css3和jquery
今天给大家介绍一款恶搞头像特效的制作过程,你可以把任意一张照片放到跳舞的漫画中,为他带上不同的帽子,让他翩翩起舞,下面我们一起来看一下制作过程和效果
评论 0
收藏 0
赞 0
分享
大图片根据分辨率自适应宽度仍居中显示
一个1920*900的大图,在1024*768的分辨率下仍居中显示,如何做到这一点,下面是一个可行的解决方案
评论 0
收藏 0
赞 0
分享
CSS3提交意见输入框样式代码
这个提交意见输入框,结构使用到了table,样式用的css3,包含了多方面的知识,比较适合新手朋友们
评论 0
收藏 0
赞 0
分享
查看更多
网络赚钱
更多
打工妹网购6000多元丰胸产品 无效要求退款时又被骗10万元
潘定国的粉丝经济学的重点:移动互联网核心是以人为本
复制网赚项目
Google
如何适当提高垃圾站Google
SEO赚钱之道:11种可以让你盈利的SEO实业方法
站长故事
更多
iPhone创造了黄牛 还是黄牛捧红了iPhone?
其实并非所有草根站长都能驯服社区门户这匹马
大学生谈网络赚钱的经历
十年了!一个依靠设计师们热情支撑起的网站
运营网站需要修炼三层内功 很多人都维持在第一层上
浅谈新手站长在网站运营中如何去养站?