Issue
I have div with 3 divs in it.
In left and right div are text and in center div needs to be toggle switch.
Here is code
<div class="doctors-appointment">
<div class="Row">
<div class="Column">
<b>Doctor's appointment</b>
</div>
<div class="Column">
<label class="switch">
<input type="checkbox">
<span class="slider round"></span>
</label>
</div>
<div class="Column">
<b>For internal purposes</b>
</div>
</div>
</div>
But toggle switch not in div
Here is screen:
I get styles from there w3school
Here is css for divs
.doctors-appointment {
clear: both;
width: 100%;
margin-top: 100px;
color: #1d69b4;
font-size: 20px;
}
.Row {
display: table;
width: 100%; /*Optional*/
table-layout: fixed; /*Optional*/
border-spacing: 10px; /*Optional*/
}
.Column {
display: table-cell;
background-color: red; /*Optional*/
}
Where is my problem?
Solution
Add this CSS
.doctors-appointment {
clear: both;
width: 100%;
margin-top: 100px;
color: #1d69b4;
font-size: 20px;
}
.Row {
display: table;
width: 100%; /*Optional*/
table-layout: fixed; /*Optional*/
border-spacing: 10px; /*Optional*/
}
.Column {
display: table-cell;
background-color: red; /*Optional*/
}
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
/* Hide default HTML checkbox */
.switch input {display:none;}
/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}
<div class="doctors-appointment">
<div class="Row">
<div class="Column">
<b>Doctor's appointment</b>
</div>
<div class="Column">
<label class="switch">
<input type="checkbox">
<span class="slider round"></span>
</label>
</div>
<div class="Column">
<b>For internal purposes</b>
</div>
</div>
</div>
Answered By - Kamal Chhirang
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.