私は2つの方法でフォーマットしたいトグルスイッチが2つあります。私はこれと戦っているだけでそれを得ることはできません。ありがとうございました!私がされている取得しようとしているどのようにこれらのトグルスイッチを並べて配置するのですか?
2つの形式...
スイッチ1(0)スイッチ2(0)
と
(これはちょうど探しています。accross正しく来ていませんラベルの下にセンタリングするスイッチ。
スイッチ1スイッチ2
(0)(0)
HTML:
Switch 1
<div class="onoffswitch">
<input type="checkbox" name="centerLockSwitch" class="onoffswitch-checkbox" id="centerLockSwitch" value="centerLockSwitch" checked>
<label class="onoffswitch-label" for="centerLockSwitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
<p>
</p>
Switch 2
<div class="keepScreenOn">
<input type="checkbox" name="keepScreenOn" class="keepScreenOn-checkbox" id="keepScreenOn" value="keepScreenOn" checked>
<label class="keepScreenOn-label" for="keepScreenOn">
<span class="keepScreenOn-inner"></span>
<span class="keepScreenOn-switch"></span>
</label>
</div>
CSS:
.onoffswitch {
position: relative;
width: 71px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
.onoffswitch-checkbox {
display: none;
}
.onoffswitch-label {
display: block;
overflow: hidden;
cursor: pointer;
border: 2px solid #999999;
border-radius: 20px;
}
.onoffswitch-inner {
display: block;
width: 200%;
margin-left: -100%;
transition: margin 0.3s ease-in 0s;
}
.onoffswitch-inner:before,
.onoffswitch-inner:after {
display: block;
float: left;
width: 50%;
height: 24px;
padding: 0;
line-height: 24px;
font-size: 14px;
color: white;
font-family: Trebuchet, Arial, sans-serif;
font-weight: bold;
box-sizing: border-box;
}
.onoffswitch-inner:before {
content: "ON";
padding-left: 10px;
background-color: #34A7C1;
color: #FFFFFF;
}
.onoffswitch-inner:after {
content: "OFF";
padding-right: 10px;
background-color: #EEEEEE;
color: #999999;
text-align: right;
}
.onoffswitch-switch {
display: block;
width: 19px;
margin: 2.5px;
background: #FFFFFF;
position: absolute;
top: 0;
bottom: 0;
right: 43px;
border: 2px solid #999999;
border-radius: 20px;
transition: all 0.3s ease-in 0s;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
margin-left: 0;
}
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
right: 0px;
}
.keepScreenOn {
position: relative;
width: 71px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
.keepScreenOn-checkbox {
display: none;
}
.keepScreenOn-label {
display: block;
overflow: hidden;
cursor: pointer;
border: 2px solid #999999;
border-radius: 20px;
}
.keepScreenOn-inner {
display: block;
width: 200%;
margin-left: -100%;
transition: margin 0.3s ease-in 0s;
}
.keepScreenOn-inner:before,
.keepScreenOn-inner:after {
display: block;
float: left;
width: 50%;
height: 24px;
padding: 0;
line-height: 24px;
font-size: 14px;
color: white;
font-family: Trebuchet, Arial, sans-serif;
font-weight: bold;
box-sizing: border-box;
}
.keepScreenOn-inner:before {
content: "ON";
padding-left: 10px;
background-color: #34A7C1;
color: #FFFFFF;
}
.keepScreenOn-inner:after {
content: "OFF";
padding-right: 10px;
background-color: #EEEEEE;
color: #999999;
text-align: right;
}
.keepScreenOn-switch {
display: block;
width: 19px;
margin: 2.5px;
background: #FFFFFF;
position: absolute;
top: 0px;
bottom: 0;
right: 43px;
border: 2px solid #999999;
border-radius: 20px;
transition: all 0.3s ease-in 0s;
}
.keepScreenOn-checkbox:checked + .keepScreenOn-label .keepScreenOn-inner {
margin-left: 0px;
}
.keepScreenOn-checkbox:checked + .keepScreenOn-label .keepScreenOn-switch {
right: 0px;
}
ありがとう!私はインラインブロックを試みましたが、それは正しくありませんでした。確かに私がこれで良くなるまで待つことはできません。どうもありがとうございました! – Fixitrod
大歓迎です! 2番目のレイアウトの解決方法については、私の編集を参照してください。 – alanbuchanan
あなたの素晴らしい!ありがとうございました! – Fixitrod