好的,所以我从中获得了一个 PHP,该 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; }
最佳答案
#leftcolrightboxcheckattach:not(:first-child):not(:last-child)
{
.....
}
关于php - 第一个 child 最后一个 child 和中间的 child ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17297649/