Does anyone have ideas on how to align CSS Slider Switches?
I tried using
position: absolute; margin-left: 15em
, but the sliders need to remain non-absolute for visual effects.
A flex grid was considered, but I don't want the switches to wrap.
Using a table is an option, but I'd prefer to find an alternative.
/* toggle switch */
.switch{position:relative;display:inline-block;width:60px;height:34px}
.switch input{display:none}
.slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:#555;-webkit-transition:.4s;transition:.4s}
.slider:before{position:absolute;content:"";height:26px;width:26px;left:4px;bottom:4px;background-color:#000;-webkit-transition:.4s;transition:.4s}input:checked+.slider{background-color:#fff}input:focus+.slider{box-shadow:0 0 1px #fff}input:checked+.slider:before{-webkit-transform:translateX(26px);-ms-transform:translateX(26px);transform:translateX(26px)}
.slider.round{border-radius:34px}
.slider.round:before{border-radius:50%}
<div class="vfor-content">
<span v-bind:id="item.name" onclick="_app.doFlipRelay(this.id)">
<span>thing 1</span>
<label class="switch">
<input type="checkbox" v-model="item.value == '1'" disabled>
<span class="slider round"></span>
</label>
</span>
</div>
<div class="vfor-content">
<span v-bind:id="item.name" onclick="_app.doFlipRelay(this.id)">
<span>thing 2 with long name</span>
<label class="switch">
<input type="checkbox" v-model="item.value == '1'" disabled>
<span class="slider round"></span>
</label>
</span>
</div>
<div class="vfor-content">
<span v-bind:id="item.name" onclick="_app.doFlipRelay(this.id)">
<span>thing 3</span>
<label class="switch">
<input type="checkbox" v-model="item.value == '1'" disabled>
<span class="slider round"></span>
</label>
</span>
</div>