DOV CSS表单:超炫的单选框与复选框效果!-Adam_DIV+CSS实例

编辑Tag赚U币
教程Tag:暂无Tag,欢迎添加,赚取U币!
  在DIV CSS构建的网页中,表单一直是一个比较头疼的问题,表单的布局与样式的定义还需要更多的学习与思考,今天介绍一款CSS表单,超炫的单选框与复选框效果。非常棒的感觉,希望对大家以后的布局有参考意义。
  我们看正常情况下此表单的效果:


  我们看经过CSS样式定义后的效果:


  实现这样的效果,作者除了对表单元素进行样式定义,还用JS对其进行了控制。

  我们看下面的CSS代码:

示例代码 [www.mb5u.com]
/* Off state for a ARC checkbox */
#labcontent .checkboxOff {
display: inline;
margin: 0px;
padding: 2px; /* NS 6 problem */
padding-left: 20px;
color: #666;
line-height: 16px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: .8em;
background-image: url(checkbox_off.gif);
background-repeat: no-repeat;
background-position: 0% 50%;
border: 0px;
}
/* On state for a ARC checkbox */
#labcontent .checkboxOn {
display: inline;
margin: 0px;
padding: 2px; /* NS 6 problem */
padding-left: 20px;
color: #000;
line-height: 16px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: .8em;
background-image: url(checkbox_on.gif);
background-repeat: no-repeat;
background-position: 0% 50%;
border: 0px;
}


/* Off state for a ARC checkbox */
#labcontent .altCheckboxOff {
display: inline;
padding: 20px 2px; /* NS 6 problem */
padding-left: 70px;
color: #666;
line-height: 60px;
font-family: "Courier New", Courier, mono;
font-size: 1.2em;
background-image: url(alt_checkbox_off.gif);
background-repeat: no-repeat;
background-position: 0% 50%;
border: 0px;
cursor: pointer;
}
/* On state for a ARC checkbox */
#labcontent .altCheckboxOn {
display: inline;
padding: 20px 2px; /* NS 6 problem */
padding-left: 70px;
color: #000;
line-height: 60px;
font-family: "Courier New", Courier, mono;
font-size: 1.2em;
font-weight: bold;
background-image: url(alt_checkbox_on.gif);
background-repeat: no-repeat;
background-position: 0% 50%;
border: 0px;
}


/* Off state for a ARC radio button */
.radioOff {
display: inline;
margin: 0px;
padding: 2px;
padding-left: 20px;
color: #666;
font: .8em/16px Verdana,Arial,Helvetica;
background: transparent url(off.gif) no-repeat 0% 50%;
}
/* On state for a ARC radio button */
.radioOn {
display: inline;
margin: 0px;
padding: 2px; /* NS 6 problem */
padding-left: 20px;
color: #000;
font: .8em/16px Verdana,Arial,Helvetica;
background: transparent url(on.gif) no-repeat 0% 50%;
}
/* use CSS to full effect with hover states. Ohhh, perty! */
.radioOn:hover {
background-image: url(on_hover.gif);
}
.radioOff:hover {
color: #333 !important;
background-image: url(off_hover.gif);
}

/* Alternative Off state for a ARC radio button */
.altRadioOff {
display: inline;
margin: 0px;
padding: 2px;
padding-left: 20px;
color: #000;
line-height: 16px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 0.8em;
background-image: url(alt_off.gif);
background-repeat: no-repeat;
background-position: 0% 50%;
border: 0px;
cursor: pointer;
}
/* Alternative On state for a ARC radio button */
.altRadioOn {
display: inline;
margin: 0px;
padding: 2px; /* NS 6 problem */
padding-left: 20px;
line-height: 16px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: .8em;
background-image: url(alt_on.gif);
background-repeat: no-repeat;
background-position: 0% 50%;
border: 0px;
cursor: pointer;
text-decoration: underline;
}

  

来源:无忧整理//所属分类:DIV+CSS实例/更新时间:2007-03-25
相关DIV+CSS实例