-1
我工作的一個網站:https://www.ffat20.nl/champions如何讓這些按鈕居中?
的問題是:
我要如何在頁面中心的按鈕?即使您將頁面縮小,也必須保持中心和響應。每個按鈕上的按鈕間距也不相同。
.box {
position: absolute;
top: -9999px;
}
label {
display: block;
position: relative;
margin: 20px;
padding: 15px 30px 15px 62px;
border: 3px solid #fff;
border-radius: 100px;
color: #fff;
background-color: #6a8494;
box-shadow: 0 0 20px rgba(0, 0, 0, .2);
white-space: nowrap;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-transition: background-color .2s, box-shadow .2s;
transition: background-color .2s, box-shadow .2s;
}
label::before {
content: '';
display: block;
position: absolute;
top: 10px;
bottom: 10px;
left: 10px;
width: 32px;
border: 3px solid #fff;
border-radius: 100px;
-webkit-transition: background-color .2s;
transition: background-color .2s;
}
label:first-of-type {
-webkit-transform: translateX(-40px);
transform: translateX(-40px);
}
label:last-of-type {
-webkit-transform: translateX(40px);
transform: translateX(40px);
}
label:hover,
input:focus+label {
box-shadow: 0 0 20px rgba(0, 0, 0, .6);
}
input:checked+label {
background-color: #ab576c;
}
input:checked+label::before {
background-color: #fff;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-6 col-lg-2">
<input id="box1" class="box" type="checkbox" />
<label for="box1">Fighter</label>
</div>
<div class="col-xs-12 col-sm-6 col-lg-2">
<input id="box2" class="box" type="checkbox" />
<label for="box2">Assassin</label>
</div>
<div class="col-xs-12 col-sm-6 col-lg-2">
<input id="box3" class="box" type="checkbox" />
<label for="box3">Support</label>
</div>
<div class="col-xs-12 col-sm-6 col-lg-2">
<input id="box4" class="box" type="checkbox" />
<label for="box4">Marksman</label>
</div>
<div class="col-xs-12 col-sm-6 col-lg-2">
<input id="box5" class="box" type="checkbox" />
<label for="box5">Tank</label>
</div>
<div class="col-xs-12 col-sm-6 col-lg-2">
<input id="box6" class="box" type="checkbox" />
<label for="box6">Tank</label>
</div>
</div>
</div>
<div>
您計劃多少次問這個問題? – k185
直到我得到我的答案@ k185 –
這不是如何堆棧的作品,你不能一直問相同的問題 – k185