css統一設定input樣式(區分input類型)

來源:互聯網
上載者:User

1.用css的expression判斷運算式

2.用css中的type選取器

3.用javascript指令碼實現

4.如果你用Microsoft Visual Studio 2005 或者後續版本開發項目,恭喜,你還可以使用skin。

下面就來講解一下各個辦法的詳細實現和它們的優缺點。

1:用css的expression判斷運算式

實現代碼參考:

      input     {     background-color:expression(this.type=="text"?'#FFC':'');     } 
另一種
  input[type="text"]     {     background-color:#FFC;     }         input[type="password"]     {     background-image:url(BG.gif);     }         input[type="submit"]     {     background-color:blue;     color:white;     }         input[type="reset"]     {     background-color:navy;     color:white;     }        input[type="radio"]     {     /*In FF,Some radio style like background-color not been supported*/     margin:10px;     }         input[type="checkbox"]     {     /*In FF,Some checkbox style like background-color not been supported*/     margin:10px;     }         input[type="button"]     {     background-color:lightblue;     } 
相關文章

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.