您的位置:首页 > Web前端 > CSS

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

2013-06-01 10:08 477 查看
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");

}

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

<!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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐