1

好的,所以我得到了一个 PHP,它由一个依赖于手头动态情况的开关循环传播(我认为)。现在,当我添加一个复选框时,我希望能够使第一个复选框div具有顶部边框和侧面,没有底部。下面的只有一个边边框,最后一个有边和底部,但没有顶部。希望这是有道理的。这是我必须编辑的所有代码:

case "E":
    $str.='<div id="leftcolrightboxcheckattach"><div id="enqattachcheckcontent" ><div id="enqleftcolattachcheckbox"><input type="checkbox" id="answer_question_'.$row['ques_id'].'[]" name="answer_question_'.$row['ques_id'].'[]" value="'.$arrMul[$i]["mul_name"].'" style="border:thick solid #fff" /></div><div id="enqleftcolattachcheckboxright">'.$arrMul[$i]["mul_name"].'</div></div></div>';
    break;

这是我的CSS。标准课程有效,last-child有效但first-child无效……任何想法为什么?

#leftcolrightboxcheckattach:first-child{width:96%; margin:5px auto; clear:both; background:#000; border-top:thin solid #E6E6E6;  position:relative; }
#leftcolrightboxcheckattach{width:96%; margin:5px auto; clear:both; background:#fff; border-left:thin solid #E6E6E6; border-right:thin solid #E6E6E6; position:relative; }
#leftcolrightboxcheckattach:last-child{width:96%; margin:5px auto; clear:both; background:#fff; border-bottom:thin solid #E6E6E6; position:relative; }
4

1 回答 1

0
#leftcolrightboxcheckattach:not(:first-child):not(:last-child)
{

      .....
}
于 2013-06-25T12:51:06.787 回答