CSS不能选择带有数字的类/ID吗? [英] CSS can't select classes/id's with numbers in it?
本文介绍了CSS不能选择带有数字的类/ID吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么您不能在CSS中使用数字,还有另一种方式来完成这项工作?我有以下代码:
Why can't you use numbers in CSS and is there another way of doing the job? I have the following code:
<div class="center 400-width" id="position">
<div class="" id="header">
Header
</div>
<div class="" id="content">
Content
</div>
<div class="" id="footer">
Footer
</div>
</div>
CSS选择类 400-width
,这表示容器的宽度为 400px
. background-color
用于检查其是否正确.
The CSS selects the class 400-width
which means the container gets a width of 400px
. And the background-color
is for checking if it's true.
.400-width{
width:400px;
background-color:blue;
color:white;
}
这不会立即发生,因为您可以在此处
It doesn't happen right now as you can see here
我通过用 400
替换 400-
来解决了这个问题.这样就变成了 fourwidth
.
I solved the problem by replacing 400-
by four
. So it becomes fourwidth
.
推荐答案
我也遇到了同样的问题....实际上这不是问题..
i have faced the same problem.... actually it not a problem anyway..
而不是'.400-width'使用'.width-400'
instead of '.400-width' use '.width-400'
这篇关于CSS不能选择带有数字的类/ID吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文