Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 具有一条规则的多个ID_Css - Fatal编程技术网

Css 具有一条规则的多个ID

Css 具有一条规则的多个ID,css,Css,我打了这个 #center-1, #center-2, #center-2, #center-3, #center-4, #center-5, #center-6, #center-7, #center-8 { float: left; width:360px; } HTML: 它不起作用,为什么?从你的报告中猜测它不起作用,你可能只是没有看到div,因为没有内容、高度或填充。加高度:10px;或者什么的,还有一些背景- 顺便说一下,在您的案例中,有一种方法可以编写此选择器: /*

我打了这个

   #center-1, #center-2, #center-2, #center-3, #center-4,
   #center-5, #center-6, #center-7, #center-8 { float: left; width:360px; }
HTML:


它不起作用,为什么?

从你的报告中猜测它不起作用,你可能只是没有看到div,因为没有内容、高度或填充。加高度:10px;或者什么的,还有一些背景-

顺便说一下,在您的案例中,有一种方法可以编写此选择器:

/* Select all <div>s in the #centerColumn */
#centerColumn div {
    float: left;
    width:360px;

    /* Test to make divs appear */
    background:#f00;
    height:10px;
    margin:1px;
}

从您的报告中猜测它不起作用,您可能只是没有看到div,因为没有内容、高度或填充。加高度:10px;或者什么的,还有一些背景-

顺便说一下,在您的案例中,有一种方法可以编写此选择器:

/* Select all <div>s in the #centerColumn */
#centerColumn div {
    float: left;
    width:360px;

    /* Test to make divs appear */
    background:#f00;
    height:10px;
    margin:1px;
}

您的div没有任何内容,这就是它们不可见的原因。要使div可见,请至少在其中添加一个,或将height/min height添加到css规则中

您的div没有任何内容,这就是它们不可见的原因。要使它们可见,请至少在其中添加一个,或在css规则中添加高度/分钟高度

可以在html id属性中显示破折号是否有效的示例?破折号或连字符在html id或css中是有效字符,因此在这段代码中没有问题。你能上传你的页面吗?可能是id不相同,或者您覆盖了CSS。但我可以检查这可能还有其他问题可以在html id属性中显示破折号是否有效的示例?破折号或连字符在html id或CSS中是有效字符,因此在这段代码中没有问题。你能上传你的页面吗?很可能是ID不一样,或者你已经覆盖了CSS。但这是我的工作检查这可能是有其他问题