css 區分 input 的類型 input[type="text"]

來源:互聯網
上載者:User

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>

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.