我的項目包含下面的代碼,但我沒有得到#男,#d等。筆者相信新的CSS你的意思是在CSS #classname
<div id="DivM" class="M" style="display: none;">
</div>
<div id="DivB" class="B" style="display: none;">
</div>
<div id="DivD" class="D" style="display: none;">
</div>
<div id="DivL" class="L" style="display: none;">
</div>
<div id="DivO" class="O" style="display: none;">
</div>
和CSS
#M {background: url(/images/M.png) no-repeat;width: 148px;height:90px;top: 18px;left:3px;outline:none;list-style:none;}
#B {background: url(/images/B.png) no-repeat;width: 292px;height:90px;top: 0;left: 0;outline:none;list-style:none;}
#D {background: url(/images/D.png) no-repeat;width: 158px;height:90px;top:18px;left:78px;outline:none;}
#L {background: url(/images/L.png) no-repeat;width: 158px;height: 50px;top:82px;left:22px;outline:none;list-style:none;}
#O {background: url(/images/O.png) no-repeat;width: 158px;height:90px;top:37px;left:36px;outline:none;list-style:none;}
包括hashtag「#」選擇元素的ID例如「#DivM」,而選擇你將使用的類。選擇器「.M」 –
是不是可以擁有#classname.But當div被加載時(頁面被加載),圖像也會在頁面上看到。 –
我明白了。這是我的錯誤。我應該使用.classname作爲class,#id作爲id。謝謝大家。 –