【发布时间】:2015-11-09 20:41:31
【问题描述】:
如何使左边框变圆?我有这个代码:
.container {
margin-top: 25px;
}
.btn-group-radio input[type=radio] {
display: none;
}
.btn-group-radio input[type=radio]:checked + .btn {
color: #333333;
background-color: #e6e6e6;
*background-color: #d9d9d9;
background-color: #cccccc \9;
background-color: #e6e6e6;
background-color: #d9d9d9 \9;
background-image: none;
outline: 0;
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn-group-radio .btn:last-child {
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
}
.btn-group-radio .btn:first-child {
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="btn-group btn-group-justified btn-group-radio" role="group" id="id_offer">
<input checked="checked" id="id_offer_0" name="offer" value="1" type="radio">
<label class="btn btn-lg btn-default" for="id_offer_0">Offer 1</label>
<input id="id_offer_1" name="offer" value="2" type="radio">
<label class="btn btn-lg btn-default" for="id_offer_1">Offer 2</label>
<input id="id_offer_2" name="offer" value="3" type="radio">
<label class="btn btn-lg btn-default" for="id_offer_2">Offer 3</label>
</div>
</div>
对于最后一个标签一切正常,对于第一个标签不起作用 none:不像在 css 中,不是 .btn-group-radio .btn:nth-child(1),.btn-g... .btn:nth-of-type(1),不是 ... label:first-child + .btn 和相同。
我如何理解first-child 在我的代码中为input 和id="id_offer_0" 工作,但我不明白为什么nth-child 不工作以及为什么nth-of-type 不工作。
【问题讨论】:
-
你到底想达到什么目的?
-
我希望将左按钮上的左圆角作为右按钮上的右角。
标签: css css-selectors pseudo-class