Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我能做什么:
HTML:
<div id="test"> HELLO! <input type="text"> </div>
CSS:
#test { color:#F00; } #test input[type=text] { background-color:#000; }
#test如果没有一个类,我想做的是同样的事情ID:
#test
ID
<div class="test"> ...
在这种情况下我应该如何编写 CSS?
用来.表示一个类。
.
.test { color: red; }
只需用#(.句点)替换:
#
.test { color:#F00; } .test input[type=text] { background-color:#000; }