2013-03-09 72 views
2

我試圖鞏固如下:用於多個屬性的CSS?

input[type="text"] { 
    width: 300px; 
} 
input[type="password"] { 
    width: 300px; 
} 

弄成這個樣子:

input[type="text"][type="password"] { 
    width: 300px; 
} 

我想這一點,type="text", "password",以及一些其他的東西。

回答

6

您可以使用許多選擇,只要你想與commas

input[type="text"],input[type="password"] { 
    width: 300px; 
} 
1

或者乾脆

input { width: 300px; } 

通過類型選擇然後應用任何其他樣式

input[type="text"] { background: #ffd; } 
input[type="password"] { background: #fff; }