clq

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理


css 区分 input 的类型 input[type="text"]

input[type="text"]{ border:1px; border-style:solid; border-color: #CCCCCC; }

--------------------------------------------------
ie6 兼容
/* ie6 不支持 */
input[type="text"]{ border:1px; border-style: solid; border-color: #CCCCCC; }

/* ie6 支持,但效果太差了,用 "Defuult" 就 ok 了! */
input{
/*
border-color:expression(this.type=="text"?"#CCCCCC":this.style.borderColor);
border:expression(this.type=="text"?"1px":this.style.border);这样不行
border:expression(this.type=="text"?"1px":this.style.bdddddorder);这样反而行,应该是脚本错误使用了缺省值
border-style:expression(this.type=="text"?"solid":this.style.borderStyle);
*/

border-color:expression(this.type=="text"?"#CCCCCC":"Default");
border:expression(this.type=="text"?"1px":"Default");
border-style:expression(this.type=="text"?"solid":"Default");

}

--------------------------------------------------
input[type="text"]{

--------------------------------------------------

<!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>无标题文档</title>
<style type="text/css">
input[type="text"]{
background-color:#FFC;}
input[type="password"]{
background-color:#339966;}
input[type="submit"]{
background-color:blue;
color:white;}
input[type="reset"]{
background-color:navy;
color:white;}
input[type="radio"]{
margin:10px;}
input[type="checkbox"]{
margin:10px;}
input[type="button"]{
background-color:lightblue;}
</style>
</head>
<body>
<dl>
<dt>textbox:<dd><input type="text" value="www.66css.com">
<dt>password:<dd><input type="password" value="www.66css.com">
<dt>submit:<dd><input type="submit">
<dt>reset:<dd><input type="reset">
<dt>radio:<dd><input type="radio" name="ground1">
<dt>checkbox:<dd><input type="checkbox" name="ground2">
<dt>button:<dd><input type="button" value="www.66css.com">
</dl>
</body>
</html>

posted on 2012-03-17 20:56  clq  阅读(4548)  评论(0编辑  收藏  举报