如果它说"oneword",那么我可以写"#oneword",但是当单词中有空格时我该写什么?
Phi*_*ton 30
你不能为id有多个单词,但你可以上课.
<p class="one two">lalala</p>
.one {
color: black;
}
.two {
font-weight: bold;
}
Run Code Online (Sandbox Code Playgroud)
将其更改为两个单词。就像其他人说的那样,您不能为ID使用空格,但可以为类使用空格。
#two-words { font-family: arial; }
.center { text-align: center; }
.bold { font-weight: bold; }
<div id="two-words" class="center bold">STUFF HERE</div>
Run Code Online (Sandbox Code Playgroud)