css - css中的#classname是什么意思

标签 css

我的元素包含以下代码,但没有得到#M、#D 等。我是 CSS 新手

        <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;}

最佳答案

这些样式将不起作用,#MidM 的元素为目标,.MMclass 为目标元素。这会起作用:

.M { ... }
.B { ... }
.D { ... }
.L { ... }
.O { ... }

或者这个:

#DivM { ... }
#DivB { ... }
#DivD { ... }
#DivL { ... }
#DivO { ... }

关于css - css中的#classname是什么意思,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15785159/

相关文章:

Javascript:关于 elem.closest() 的逻辑

javascript - 用 chrome 去除触摸屏上的蓝色光标

css - 底部有部分水平线的页脚

javascript - 在 ajax 调用后使用点击不起作用

html - 使类型为 'text' 的表单输入具有灰色背景

html - 如何使我的页眉布局像这样?

html - 如何在另一个 <div> 标签中选择一个 <div> 标签?

javascript - 调整窗口大小后,将父级 (div) 高度更改为其子级 (p) 的大小

java - Spring - 无法加载资源(CSS)

javascript - 如何让 div/table 改变它们的大小?