本文介绍了CSS不能选择类/ id的数字在它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我碰到一个问题。

我给了div,所有其他div都在名为Center和400-width的类中。这意味着div必须居中,宽度为400.

I gave the div where all the other divs are in the class named Center and 400-width. Which means the div has to be centered and have a width of 400.

<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。背景颜色用于检查是否为真。

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: http://jsfiddle.net/gekkeabt/XQjE4/1/

我通过将400-替换为四来解决了这个问题。所以它变成四分之一

I solved the problem by replacing 400- by four. So it becomes fourwidth

但我的问题是。为什么你不能在CSS中使用数字,是否有另一种方式来完成这项工作?

But my question is. Why can't you use numbers in CSS and is there another way of doing the job?

谢谢!

推荐答案

我面临同样的问题....其实它不是一个问题反正..

i have faced the same problem.... actually it not a problem anyway..

而不是'.400- width'use'.width-400'

instead of '.400-width' use '.width-400'

这篇关于CSS不能选择类/ id的数字在它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 23:15