2011-05-03 120 views
-1

我是新来的CSS,我想我要问一个愚蠢的问题, 在CSS遇到问题类

我写了这首=

input.text, input[type="text"], input.password, input[type="password"], textarea, select { border: 1px solid black; } 

,这我写了事后=

.HTMLWidget-2 input.text, input[type="text"], input.password, input[type="password"], textarea, select .subscribeInput { background-color: grey; } 

和一切都像第二个出来。 谢谢。

+1

什么的HTML是什么样子? – morewry 2011-05-03 21:26:09

+4

那么你的问题是什么? – Dave 2011-05-03 21:26:17

+0

如果你的两条线都在运行,那么第二条线肯定会覆盖第一条线。第一行和第二行大部分似乎指的是相同的类和元素。 – robx 2011-05-03 21:28:47

回答

0

你写的是什么基本上等同于:

select { border: 1px solid black; } 

.HTMLWidget-2 input.text, 
select .subscribeInput { background-color: grey; } 

input[type="text"], 
input.password, 
input[type="password"], 
textarea{ 
    border: 1px solid black; 
    background-color: grey 
} 

如果您在.HTMLWidget-2只想投入有它需要在每一个选择的背景,例如:

input.text, 
input[type="text"], 
input.password, 
input[type="password"], 
textarea, 
select { 
    border: 1px solid black; 
} 

.HTMLWidget-2 input.text, 
.HTMLWidget-2 input[type="text"], 
.HTMLWidget-2 input.password, 
.HTMLWidget-2 input[type="password"], 
.HTMLWidget-2 textarea, 
.HTMLWidget-2 select { 
    background-color: grey; 
} 

虽然我回想... IE7(我认为)和IE6不会改变默认的select边框。