首页
网页制作
网络编程
脚本专栏
数据库
网站运营
网络安全
平面设计
CMS教程
搜索
建站极客
网页制作
CSS
正文
表单label美化代码
所属分类:
网页制作
/
CSS
阅读数: 1359
收藏 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>
提示:您可以先修改部分代码再运行
请注意图片的地址。
更多精彩内容
其他人还在看
CSS3实现背景透明文字不透明的示例代码
这篇文章主要介绍了CSS3实现背景透明文字不透明的示例代码的相关资料,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
评论 0
收藏 0
赞 0
分享
浅谈CSS中的尺寸单位
这篇文章主要介绍了浅谈CSS中的尺寸单位的相关资料,浏览器的兼容性越来越好,移动端基本是清一色的webkit,经常会用到css的不同尺寸/长度单位,这里做个整理。感兴趣的小伙伴们可以参考一下
评论 0
收藏 0
赞 0
分享
CSS中有些属性的前面会加上“*”或“_”所代表的意思
这篇文章主要介绍了CSS中有些属性的前面会加上“*”或“_”所代表的意思,需要的朋友可以参考下
评论 0
收藏 0
赞 0
分享
CSS 设置滚动条样式的实例代码
这篇文章主要介绍了CSS 设置滚动条样式的实例代码,非常不错,具有一定的参考借鉴价值,需要的朋友参考下吧
评论 0
收藏 0
赞 0
分享
纯CSS制作各种各样的网页图标(三角形、暂停按钮、下载箭头、加号等)
这篇文章主要介绍了纯CSS制作各种各样的网页图标(三角形、暂停按钮、下载箭头、加号等)的相关资料,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
评论 0
收藏 0
赞 0
分享
纯css实现多级折叠菜单折叠树效果
这篇文章主要介绍了纯css实现多级折叠菜单折叠树效果,运用checkbox的checked值来判断下级栏目是否展开,通过css3选择器提供的checked伪类来实现此效果,感兴趣的朋友参考下吧
评论 0
收藏 0
赞 0
分享
CSS Grid 网格布局全解析
这篇文章主要介绍了CSS Grid 网格布局全解析的相关资料,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
评论 0
收藏 0
赞 0
分享
css flex 弹性布局详解
这篇文章主要介绍了css flex 弹性布局详解的相关资料,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
评论 0
收藏 0
赞 0
分享
CSS3 二级导航菜单的制作的示例
这篇文章主要介绍了CSS3 二级导航的制作的示例的相关资料,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
评论 0
收藏 0
赞 0
分享
使用css禁用input、checkbox、select等html控件实现disable效果
这篇文章主要介绍了使用css禁用input、checkbox、select等html控件实现disable效果,需要的朋友可以参考下
评论 0
收藏 0
赞 0
分享
查看更多
网络赚钱
更多
男子凭一张八卦图忽悠60多亲友发红包 短短1小时内获得300元红包
代刷信誉不能信,哪些网络兼职值得信赖呢?说说那些可靠的网络兼职
adsense西联邮局收款两张版本单子填写示例
广告如何投放才最正确有效?我就给你3个建议!
在校大学生利用网络可以做什么?在校大学生利用网络赚钱方式介绍
Papi酱首次直播的八大平台是哪些 打赏90万服不服
站长故事
更多
美团副总裁杨俊:做O2O的4个关键节点 会高效率地花钱
传统地摊转型网络营销90后农村小伙子月入过万
阿里会成为下一个谷歌?谁是Google真正的挑战者
小白站长:一次网站被 K 的经历
运营网站需要修炼三层内功 很多人都维持在第一层上
为什么知乎做起来了?市场竞争的魅力和价值