CSS styled checkbox not working when clicked - html

Index.html
<div class="wrap">
<div class="toggle">
<input type="checkbox" onclick='window.location.assign("newuser.html")'/>
<span class="btn"></span>
<span class="texts"></span>
<span class="bg"></span>
</div>
</div>
Index.css
#import url(http://fonts.googleapis.com/css? family=Open+Sans:400,600|Lato:300,400,700&subset=latin,cyrillic);
* {
margin: 0;
padding: 0;
}
body {
background: #ecf0f1;
}
.wrap {
width: 90px;
margin: 50px auto;
}
.toggle {
position: relative;
width: 82px;
height: 35px;
border: 3px solid #f9f9f9;
border-radius: 40px;
}
.toggle input[type="checkbox"] {
opacity: 0;
cursor: pointer;
position: absolute;
top: 0;
left: 0;
z-index: 10;
width: 84px;
height: 34px;
}
.toggle .btn {
display: block;
position: absolute;
z-index: 4;
top: -3px;
left: -1px;
width: 37px;
height: 37px;
background: #F5F5F5;
border: 1px solid #e8e8e8;
border-radius: 100%;
box-shadow: 0 2px 4px rgba(100, 100, 100, 0.1);
transition: left .25s ease-in-out;
}
.toggle input[type="checkbox"]:checked ~ .btn {
left: 44px;
}
.toggle .texts {
position: absolute;
top: 9px;
z-index: 2;
width: 100%;
font-family: 'Lato', Helvetica, sans-serif;
font-weight: bold;
color: #fff;
text-transform: uppercase;
font-size: 14px;
}
.toggle .texts:before {
content: "On";
position: absolute;
left: 12px;
}
.toggle .texts:after {
content: "Off";
position: absolute;
right: 11px;
}
.toggle .bg {
display: block;
background: #F56557;
position: absolute;
z-index: 0;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 40px;
box-shadow: inset 0 0px 2px 1px rgba(0, 0, 0, 0.3);
transition: background .25s ease-in;
}
.toggle input[type="checkbox"]:checked ~ .bg {
background: #48C893;
}
I am creating an Android mobile application and I ran this code in Eclipse Luna. I managed to show the button but when it is clicked, nothing happens.

Your code is working. The style is changed onclick.
The problem might be somewhere else
* {
margin: 0;
padding: 0;
}
body {
background: #ecf0f1;
}
.wrap {
width: 90px;
margin: 50px auto;
}
.toggle {
position: relative;
width: 82px;
height: 35px;
border: 3px solid #f9f9f9;
border-radius: 40px;
}
.toggle input[type="checkbox"] {
opacity: 0;
cursor: pointer;
position: absolute;
top: 0;
left: 0;
z-index: 10;
width: 84px;
height: 34px;
}
.toggle .btn {
display: block;
position: absolute;
z-index: 4;
top: -3px;
left: -1px;
width: 37px;
height: 37px;
background: #F5F5F5;
border: 1px solid #e8e8e8;
border-radius: 100%;
box-shadow: 0 2px 4px rgba(100, 100, 100, 0.1);
transition: left .25s ease-in-out;
}
.toggle input[type="checkbox"]:checked ~ .btn {
left: 44px;
}
.toggle .texts {
position: absolute;
top: 9px;
z-index: 2;
width: 100%;
font-family: 'Lato', Helvetica, sans-serif;
font-weight: bold;
color: #fff;
text-transform: uppercase;
font-size: 14px;
}
.toggle .texts:before {
content: "On";
position: absolute;
left: 12px;
}
.toggle .texts:after {
content: "Off";
position: absolute;
right: 11px;
}
.toggle .bg {
display: block;
background: #F56557;
position: absolute;
z-index: 0;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 40px;
box-shadow: inset 0 0px 2px 1px rgba(0, 0, 0, 0.3);
transition: background .25s ease-in;
}
.toggle input[type="checkbox"]:checked ~ .bg {
background: #48C893;
}
<div class="wrap">
<div class="toggle">
<input type="checkbox" />
<span class="btn"></span>
<span class="texts"></span>
<span class="bg"></span>
</div>
</div>

Look into the below jsfiddle for your code
your onClick might be faster that your vision
your code seems working fine please check from your end

Related

Create simple CSS modal window

The goal is to create a simple and CSS-only modal window (popup), when the user clicks a link.
With no dependencies or any kind of script, and with as less code as possible.
.box {
width: 40%;
margin: 0 auto;
background: rgba(255,255,255,0.2);
padding: 35px;
border: 2px solid #fff;
border-radius: 20px/50px;
background-clip: padding-box;
text-align: center;
}
.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
<div class="box">
<a class="button" href="#popup1">Open</a>
</div>
<div id="popup1" class="overlay">
<div class="popup">
<h2>Here i am</h2>
<a class="close" href="#">×</a>
</div>
</div>
I created this simple modal window:
.exit-intent {
opacity: 0;
visibility: hidden;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
text-align: center;
background-color: rgba(255, 255, 255, .8);
z-index: 7;
display: flex;
flex-direction: column;
height: 100vh;
overflow-y: auto
}
.exit-intent {
position: fixed;
max-width: 500px;
border-radius: 10px;
background: rgba(255, 255, 255, 0.9);
visibility: hidden;
opacity: 0;
z-index: 1;
}
.exit-intent:target {
visibility: visible;
opacity: 1;
}
.exit-intent-close {
position: absolute;
max-width: 500px;
border-radius: 10px;
background: rgba(255, 255, 255, 0.9);
}
.exit-intent .close {
position: absolute;
right: 5px;
top: 5px;
padding: 5px;
color: #000;
font-size: 2em;
line-height: 0.6em;
font-weight: bold;
}
.exit-intent .close:hover {
color: #999;
}
.close-exit-intent {
background: rgba(0, 0, 0, 0.7);
cursor: default;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
opacity: 0;
visibility: hidden;
}
.exit-intent:target+.close-exit-intent {
opacity: 1;
visibility: visible;
}
Link
<div id="exit-intent" class="exit-intent">
×
<h2>Window</h2>
</div>

Custom slider positioning elements over it.(HTML+CSS)

Creating a custom slider which should be supporting Chrome and IE11.
Facing issues positioning the thumb and elements(White circle and red oval) on the slider track.
The white circles should be connected with a line.
Here is the fiddle of what i have achieved.
https://jsfiddle.net/Pravin_it14/7t9bsrdn/7/
/*Slider*/
.areaDetail_graph_04 {
height: 87px;
width: 614px!important;
position: relative;
/* background-color: rgba(255,255,255,0.5); */
/* border-radius: 8px 8px 8px 8px; */
}
.areaDetail_graph_04 .img {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAmYAAABXCAYAAACulYmrAAAACXBIWXMAAAsSAAALEgHS3X78AAADzklEQVR4nO3dT25TVxTA4ROHCuq4LaZS1M5AQuowLCE7apbQJSQ7yhYyrIQEM6pIjaGx3UYUXB3zAlWC0H0PiI+U75tkEsfRu5Of7r+3tVqt4qrZfPkwIg4iYj8i9q79AgAAQ5xExHFEHE4n4+dXP38tzGbz5WFE/OpRAwB8VUfTyfjg/1/wPsxm8+X9ruDMkAEA3IycQdufTsYv89tGIcoAADYl2+u4a7F3YRYRv4kyAICN2OtaLLbOzhe50f+ZcQAA2KhHo+70JQAAm3Uw6q7EAABgs/ZzKfP6RWYAANy4kUcOAFCDMAMAKEKYAQAUIcwAAIoQZgAARdz5nH9jcfE6Xryax19/X8TFv2+MKQBwK929sx3ff3s3dr8br38ONei6jIywp6ezdZABAPBBhtnj3ek61vrqHWZni3/WUfbm7VtDAADwEduj0TrOHuzc6/V4eu0xyyj7/Y8/RRkAwCdkK2UzZTv10Rxml8uXAAC0yXbqsw+/OcwsXwIA9JPt1GdiqynMcpO/jf4AAP1lQ+VNFi2awuz0fGkYAAAGyuvFWjTPmAEAMExrSzWFmctjAQCGa20pr2QCAChCmAEAFCHMAACKEGYAAEU0hdmQl3ACANCvpZrCLN+SDgDAMK0t1RRmP/8wMQwAAAO1tlRTmO3c/casGQDAANlQ2VItmjf/P96dxvbIWQEAgFbZTtlQrZpLKzet9fnDAAC3XbZTn0OUvabAHuzci19++tHMGQDAJ2QrZTNlO/WxdXa+WPV9sPm+p6enMy83BwC4IveU9Z0puzQozC4tLl7Hi1fzdaB50TkAcFtlhGWQ5enL1o3+H/NZYQYAwJdjsxgAQBHCDACgCGEGAFCEMAMAKEKYAQAUIcwAAIoQZgAARQgzAIAihBkAQBHCDACgCGEGAFCEMAMAKEKYAQAUIcwAAIoQZgAARQgzAIAihBkAQBHCDACgCGEGAFCEMAMAKEKYAQAUIcwAAIoQZgAARQgzAIAihBkAQBHCDACgCGEGAFCEMAMAKEKYAQAUIcwAAIoQZgAARQgzAIAihBkAQBHCDACgCGEGAFCEMAMAKEKYAQAUIcwAAIoQZgAARQgzAIAihBkAQBEZZicGAwBg404yzI6NAwDAxh1vnZ0vHkbEM2MBALBRj0bTyfh5RBwZBwCAjTnKJttarVYxmy/vd0uae8YDAOBGnUwn4ydxeSpzOhm/jIh9BwEAAG7USddga++vy8g462rNsiYAwNeXy5dPugmytfVS5lWz+TIPBBx0BWd5EwDgy8gZstw+dtjt8/8gIv4DGWnfdriGm90AAAAASUVORK5CYII=);
height: 87px;
margin-left: -1px;
width: 614px!important;
z-index: 1;
position: absolute;
top: 0;
}
.range {
position: absolute;
top: 0;
z-index: 99;
width: 614px!important;
}
.range-labels {
margin: 55px -20px 0 5px;
padding: 0;
list-style: none;
width: 614px!important;
}
.range-labels li {
position: relative;
float: left;
width: 100px;
text-align: center;
color: #808093;
font-size: 11px;
font-weight: 600;
cursor: pointer;
}
.range-labels li::before {
position: absolute;
top: -35px;
right: 0;
left: 0px;
content: "";
margin: 0 auto;
width: 10px;
height: 10px;
background: #E9EEF0;
border-radius: 50%;
}
.range-labels li:nth-child(1):before {
position: absolute;
top: -42px;
right: 0;
left: -20px;
content: "";
margin: 0 auto;
width: 35px;
height: 23px;
background: #F06C81;
border-radius: 40%;
}
.range-labels li:nth-child(2):before {
position: absolute;
top: -42px;
right: 0;
left: -20px;
content: "";
margin: 0 auto;
width: 35px;
height: 23px;
background: #F06C81;
border-radius: 40%;
}
.range-labels li:nth-child(3):before {
position: absolute;
top: -42px;
right: 0;
left: -20px;
content: "";
margin: 0 auto;
width: 35px;
height: 23px;
background: #F06C81;
border-radius: 40%;
}
.range-labels li:nth-child(4):before {
position: absolute;
top: -42px;
right: 0;
left: -20px;
content: "";
margin: 0 auto;
width: 35px;
height: 23px;
background: #F06C81;
border-radius: 40%;
}
.range-labels li:nth-child(5):before {
position: absolute;
top: -42px;
right: 0;
left: -35px;
content: "";
margin: 0 auto;
width: 35px;
height: 23px;
background: #F06C81;
border-radius: 40%;
}
.range-labels li:nth-child(6):before {
position: absolute;
top: -42px;
right: 0;
left: -50px;
content: "";
margin: 0 auto;
width: 35px;
height: 23px;
background: #826AA7;
border-radius: 40%;
}
.range-labels li::after {
position: absolute;
top: -35px;
right: 0;
left: 0px;
content: "";
margin: 0 auto;
width: 9px;
height: 9px;
background: #E9EEF0;
border-radius: 50%;
}
input[type=range] {
-webkit-appearance: none;
margin: 0px 0 0 30px;
width: 88%;
z-index: 9999;
}
input[type=range]:focus {
outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
height: 2px;
background: #E9EEF0;
width: 100%;
cursor: pointer;
animate: 0.2s;
}
input[type=range]::-webkit-slider-thumb {
position: relative;
height: 29px;
width: 29px;
background: transparent;
cursor: pointer;
z-index: 9999;
-webkit-appearance: none;
margin-top: -14px;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsSAAALEgHS3X78AAACeklEQVRIicWXMWgTYRiGv+T+y9WgtlocSrAekmBDS61ZrEtHoZSCg0MHIVNBJDg5hg6S0amEUugU6ODQoYuLY5fWpUZR0pJQLi2hiFitldjL3Rl5691xJrnepfnTvpAld3mfu+///+97E6jX6+RXyUx2jIjwkR0/UYgon0un8n59PKEAhXukl6qmPZREMXDjWl/oeu8V+/rB4RF9/f6jpmpaXRLFt9Vjdc7rAVyhyUxWDvdIyzVNv39HvslityLU33vV1ehX9Td9Kim0rezpIZG9qx6rT3LplOIbmsxkHwlC8PWQPCgl4lEKieKp1XCqpmm0WSjRlrKrGsafmVw6teoJffpq6Zmu6/MP7g4LscGIb1ijirsVWv/w2WCMPV98MbvgCsUbikxYmZoYF04rpV99O/xJb9Y2DE03HjvfOOgAyigp3pAHEIIP/OAL/yYoNg3WsJOSthL8bkcGJPj/B8WxwC7FpumGxkfjBH/znP+D4hziWLSzS9sRfOEPjg3FwR+JyrwYLYVzDg6uMbPjBC6HL7W8ebNQpPdbJd/m94ailIjHmr7HpkJHA4+hl6K1uZnAoJXJWQROef/LGMorO3tpN2Vy5OC50BrEvG7gtaZOAapgPLmJ55qaHAXlzWMecnH1kMnJBzFwMYDRnLsp+IMD3smaYuIXy5Xp/tHmRs9rTYvlygmHrI2EiLGt7E0m4tGmVshjTTHYkSh0w5gjqw3ilRExMPG7oY2PBYK/lZ3sc4pMg4iBic9T8Nup7Kvwt2xtKEIUMg0iBq9NBR/4mVnJDmkXn5EsdZoGsYYoqe806AC3lXtRShyLM+feBvj5JXy3B+j4vwwR/QWs5oN+Ncbm9gAAAABJRU5ErkJggg==);
}
input[type=range]::-ms-track {
position: absolute;
width: 100%;
height: 2px;
cursor: pointer;
animate: 0.2s;
margin-top: -10px;
background: transparent;
border-color: transparent;
border-width: 16px 0;
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: #E9EEF0;
border: 0.2px solid#E9EEF0;
border-radius: 2.6px;
box-shadow: 1px 1px 1px #E9EEF0, 0px 0px 1px #E9EEF0;
}
input[type=range]::-ms-fill-upper {
background: #E9EEF0;
border: 0.2px solid #E9EEF0;
border-radius: 2.6px;
box-shadow: 1px 1px 1px #E9EEF0, 0px 0px 1px #E9EEF0;
}
input[type=range]::-ms-thumb {
position: absolute;
z-index: 99999;
border: transparent;
height: 29px;
width: 29px;
background: transparent;
cursor: pointer;
background-image: url("../parts/icons/handle.png");
}
input[type=range]:focus::-ms-fill-lower {
background: #E9EEF0;
}
input[type=range]:focus::-ms-fill-upper {
background: #E9EEF0;
}
<div class="areaDetail_graph_04">
<div class="img">
<div class="range">
<input type="range" class="slider" width="614px" value="0" min="0" max="5" id="rangeSlider">
</div>
<ul class="range-labels">
<li>11:00</li>
<li>12:00</li>
<li>13:00</li>
<li>14:00</li>
<li>15:00</li>
<li>16:00</li>
</ul>
<span id="valBox"></span>
</div>
</div>
Do you mean the white circle is behind the white line?
You could try adding "margin-bottom: -15px;" to
"input[type=range]::-webkit-slider-runnable-track";
In addition, you'd better change the position of the circles inside li(5) and li (6).
use "left: -20px;"both in "li:nth-child(5)" and "li:nth-child(6)".
The complete code is as follows:
/*Slider*/
.areaDetail_graph_04 {
height: 87px;
width: 614px!important;
position: relative;
/* background-color: rgba(255,255,255,0.5); */
/* border-radius: 8px 8px 8px 8px; */
}
.areaDetail_graph_04 .img {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAmYAAABXCAYAAACulYmrAAAACXBIWXMAAAsSAAALEgHS3X78AAADzklEQVR4nO3dT25TVxTA4ROHCuq4LaZS1M5AQuowLCE7apbQJSQ7yhYyrIQEM6pIjaGx3UYUXB3zAlWC0H0PiI+U75tkEsfRu5Of7r+3tVqt4qrZfPkwIg4iYj8i9q79AgAAQ5xExHFEHE4n4+dXP38tzGbz5WFE/OpRAwB8VUfTyfjg/1/wPsxm8+X9ruDMkAEA3IycQdufTsYv89tGIcoAADYl2+u4a7F3YRYRv4kyAICN2OtaLLbOzhe50f+ZcQAA2KhHo+70JQAAm3Uw6q7EAABgs/ZzKfP6RWYAANy4kUcOAFCDMAMAKEKYAQAUIcwAAIoQZgAARdz5nH9jcfE6Xryax19/X8TFv2+MKQBwK929sx3ff3s3dr8br38ONei6jIywp6ezdZABAPBBhtnj3ek61vrqHWZni3/WUfbm7VtDAADwEduj0TrOHuzc6/V4eu0xyyj7/Y8/RRkAwCdkK2UzZTv10Rxml8uXAAC0yXbqsw+/OcwsXwIA9JPt1GdiqynMcpO/jf4AAP1lQ+VNFi2awuz0fGkYAAAGyuvFWjTPmAEAMExrSzWFmctjAQCGa20pr2QCAChCmAEAFCHMAACKEGYAAEU0hdmQl3ACANCvpZrCLN+SDgDAMK0t1RRmP/8wMQwAAAO1tlRTmO3c/casGQDAANlQ2VItmjf/P96dxvbIWQEAgFbZTtlQrZpLKzet9fnDAAC3XbZTn0OUvabAHuzci19++tHMGQDAJ2QrZTNlO/WxdXa+WPV9sPm+p6enMy83BwC4IveU9Z0puzQozC4tLl7Hi1fzdaB50TkAcFtlhGWQ5enL1o3+H/NZYQYAwJdjsxgAQBHCDACgCGEGAFCEMAMAKEKYAQAUIcwAAIoQZgAARQgzAIAihBkAQBHCDACgCGEGAFCEMAMAKEKYAQAUIcwAAIoQZgAARQgzAIAihBkAQBHCDACgCGEGAFCEMAMAKEKYAQAUIcwAAIoQZgAARQgzAIAihBkAQBHCDACgCGEGAFCEMAMAKEKYAQAUIcwAAIoQZgAARQgzAIAihBkAQBHCDACgCGEGAFCEMAMAKEKYAQAUIcwAAIoQZgAARQgzAIAihBkAQBEZZicGAwBg404yzI6NAwDAxh1vnZ0vHkbEM2MBALBRj0bTyfh5RBwZBwCAjTnKJttarVYxmy/vd0uae8YDAOBGnUwn4ydxeSpzOhm/jIh9BwEAAG7USddga++vy8g462rNsiYAwNeXy5dPugmytfVS5lWz+TIPBBx0BWd5EwDgy8gZstw+dtjt8/8gIv4DGWnfdriGm90AAAAASUVORK5CYII=);
height: 87px;
margin-left: -1px;
width: 614px!important;
z-index: 1;
position: absolute;
top: 0;
}
.range {
position: absolute;
top: 0;
z-index: 99;
width: 614px!important;
}
.range-labels {
margin: 55px -20px 0 5px;
padding: 0px;
list-style: none;
width: 614px!important;
}
.range-labels li {
position: relative;
float: left;
width: 100px;
text-align: center;
color: #808093;
font-size: 11px;
font-weight: 600;
cursor: pointer;
}
.range-labels li::before {
position: absolute;
top: -35px;
right: 0;
left: 0px;
content: "";
margin: 0 auto;
width: 10px;
height: 10px;
background: #E9EEF0;
border-radius: 50%;
}
.range-labels li:nth-child(1):before {
position: absolute;
top: -42px;
right: 0;
left: -10px;
content: "";
margin: 0 auto;
width: 35px;
height: 23px;
background: #F06C81;
border-radius: 40%;
}
.range-labels li:nth-child(2):before {
position: absolute;
top: -42px;
right: 0;
left: -10px;
content: "";
margin: 0 auto;
width: 35px;
height: 23px;
background: #F06C81;
border-radius: 40%;
}
.range-labels li:nth-child(3):before {
position: absolute;
top: -42px;
right: 0;
left: -4px;
content: "";
margin: 0 auto;
width: 35px;
height: 23px;
background: #F06C81;
border-radius: 40%;
}
.range-labels li:nth-child(4):before {
position: absolute;
top: -42px;
right: 0;
left: 0px;
content: "";
margin: 0 auto;
width: 35px;
height: 23px;
background: #F06C81;
border-radius: 40%;
}
.range-labels li:nth-child(5):before {
position: absolute;
top: -42px;
right: 0;
/*left: -35px;*/
left: 6px;
content: "";
margin: 0 auto;
width: 35px;
height: 23px;
background: #F06C81;
border-radius: 40%;
}
.range-labels li:nth-child(6):before {
position: absolute;
top: -42px;
right: 0;
/*left: -50px;*/
left: 8px;
content: "";
margin: 0 auto;
width: 35px;
height: 23px;
background: #826AA7;
border-radius: 40%;
}
/*White circle01*/
.range-labels li:nth-child(1):after {
left: -6px;
}
/*White circle02*/
.range-labels li:nth-child(2):after {
left: -10px;
}
/*White circle03*/
.range-labels li:nth-child(3):after {
left: -1px;
}
/*White circle04*/
.range-labels li:nth-child(4):after {
left: 0px;
}
/*White circle05*/
.range-labels li:nth-child(5):after {
left: 7px;
}
/*White circle06*/
.range-labels li:nth-child(6):after {
left: 10px;
}
/*White circle*/
.range-labels li::after {
position: absolute;
top: -35px;
right: 0px;
/*left: 0px;*/
content: "";
margin: 0px auto;
width: 9px;
height: 9px;
background: #E9EEF0;
border-radius: 50%;
}
input[type=range] {
-webkit-appearance: none;
margin: -10px 0px 0px 35px;
width: 88%;
z-index: 9999;
}
input[type=range]:focus {
outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
height: 2px;
background: #E9EEF0;
width:100%;
margin-bottom: -15px; /*add*/
/*margin-right: -5px;*/
cursor: pointer;
animate: 0.2s;
}
input[type=range]::-webkit-slider-thumb {
position: relative;
height: 29px;
width: 29px;
background: transparent;
cursor: pointer;
z-index: 9999;
-webkit-appearance: none;
margin-top: -14px;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsSAAALEgHS3X78AAACeklEQVRIicWXMWgTYRiGv+T+y9WgtlocSrAekmBDS61ZrEtHoZSCg0MHIVNBJDg5hg6S0amEUugU6ODQoYuLY5fWpUZR0pJQLi2hiFitldjL3Rl5691xJrnepfnTvpAld3mfu+///+97E6jX6+RXyUx2jIjwkR0/UYgon0un8n59PKEAhXukl6qmPZREMXDjWl/oeu8V+/rB4RF9/f6jpmpaXRLFt9Vjdc7rAVyhyUxWDvdIyzVNv39HvslityLU33vV1ehX9Td9Kim0rezpIZG9qx6rT3LplOIbmsxkHwlC8PWQPCgl4lEKieKp1XCqpmm0WSjRlrKrGsafmVw6teoJffpq6Zmu6/MP7g4LscGIb1ijirsVWv/w2WCMPV98MbvgCsUbikxYmZoYF04rpV99O/xJb9Y2DE03HjvfOOgAyigp3pAHEIIP/OAL/yYoNg3WsJOSthL8bkcGJPj/B8WxwC7FpumGxkfjBH/znP+D4hziWLSzS9sRfOEPjg3FwR+JyrwYLYVzDg6uMbPjBC6HL7W8ebNQpPdbJd/m94ailIjHmr7HpkJHA4+hl6K1uZnAoJXJWQROef/LGMorO3tpN2Vy5OC50BrEvG7gtaZOAapgPLmJ55qaHAXlzWMecnH1kMnJBzFwMYDRnLsp+IMD3smaYuIXy5Xp/tHmRs9rTYvlygmHrI2EiLGt7E0m4tGmVshjTTHYkSh0w5gjqw3ilRExMPG7oY2PBYK/lZ3sc4pMg4iBic9T8Nup7Kvwt2xtKEIUMg0iBq9NBR/4mVnJDmkXn5EsdZoGsYYoqe806AC3lXtRShyLM+feBvj5JXy3B+j4vwwR/QWs5oN+Ncbm9gAAAABJRU5ErkJggg==);
}
input[type=range]::-ms-track {
position: absolute;
width: 100%;
height: 2px;
cursor: pointer;
animate: 0.2s;
margin-top: -10px;
background: transparent;
border-color: transparent;
border-width: 16px 0;
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: #E9EEF0;
border: 0.2px solid#E9EEF0;
border-radius: 2.6px;
box-shadow: 1px 1px 1px #E9EEF0, 0px 0px 1px #E9EEF0;
}
input[type=range]::-ms-fill-upper {
background: #E9EEF0;
border: 0.2px solid #E9EEF0;
border-radius: 2.6px;
box-shadow: 1px 1px 1px #E9EEF0, 0px 0px 1px #E9EEF0;
}
input[type=range]::-ms-thumb {
position: absolute;
z-index: 99999;
border: transparent;
height: 29px;
width: 29px;
background: transparent;
cursor: pointer;
background-image: url("../parts/icons/handle.png");
}
input[type=range]:focus::-ms-fill-lower {
background: #E9EEF0;
}
input[type=range]:focus::-ms-fill-upper {
background: #E9EEF0;
}
<div class="areaDetail_graph_04">
<div class="img">
<div class="range">
<input type="range" class="slider" width="614px" value="0" min="0" max="5" id="rangeSlider">
</div>
<ul class="range-labels">
<li>11:00</li>
<li>12:00</li>
<li>13:00</li>
<li>14:00</li>
<li>15:00</li>
<li>16:00</li>
</ul>
<span id="valBox"></span>
</div>
</div>

Positioning the input form in the middle using margin: 0 auto not working

I'm trying to position the input form in the middle of form container using margin: 0 auto;, but not working.
I selected the div container and apply this:
.group {
position: relative;
top: 20px;
margin: 0 auto;
}
body {
background-color: Royalblue; /*#f0f0f0;*/
margin: 0px;
}
form {
position: relative;
top: 90px;
margin: 0 auto;
width: 280px;
height: 340px;
border: 1px solid #B0C4DE;
background: royalblue;
border-radius: 0px;
border-radius: 10px 10px 10px 10px;
}
/* Main EFFECT ================================ */
input {
position: relative;
top: 0px;
left: 0px;
font-family: 'Montserrat', sans-serif;
border: 0;
border-bottom: 1px solid white;
background: transparent;
font-size: 15px;
height: 25px;
width: 180px;
outline: 0;
z-index: 1;
color: black;
}
label {
display: block;
}
span {
position: absolute;
top: 7px;
left: 0px;
font-family: 'Montserrat', sans-serif;
font-size: 13px;
z-index: 1;
color: white;
transition: top .5s ease, font-size .5s ease;
}
.group {
position: relative;
top: 20px;
margin: 0 auto;
}
/*
label::after {
content: '';
position: absolute;
top: 5px;
left: 0px;
width: 200px;
height: 23px;
border-radius: 2px;
background: beige;
transition: transform .7s;
transform: scale3d(1, 0.1, 1);
transform-origin: bottom;
}
*/
/*
input:focus + label::after {
top: 5px;
transform: scale3d(1, 1.2, 1);
transition-timing-function: linear;
}
input:focus + label > span {
top: -20px;
font-size: 10px;
}
*/
<body>
<form>
<div class="group">
<input class="input1" type="email" id="email" required />
<label class="label1" for="email">
<span class="sp1">Email</span>
</label>
</div>
</form>
</body>
without width browser can not calculate how much margins it will put to left/right
you can see here in your case decrease width
http://prntscr.com/kvqscq
body {
background-color: Royalblue; /*#f0f0f0;*/
margin: 0px;
}
form {
position: relative;
top: 90px;
margin: 0 auto;
width: 280px;
height: 340px;
border: 1px solid #B0C4DE;
background: royalblue;
border-radius: 0px;
border-radius: 10px 10px 10px 10px;
}
/* Main EFFECT ================================ */
input {
position: relative;
top: 0px;
left: 0px;
font-family: 'Montserrat', sans-serif;
border: 0;
border-bottom: 1px solid white;
background: transparent;
font-size: 15px;
height: 25px;
width: 180px;
outline: 0;
z-index: 1;
color: black;
}
label {
display: block;
}
span {
position: absolute;
top: 7px;
left: 0px;
font-family: 'Montserrat', sans-serif;
font-size: 13px;
z-index: 1;
color: white;
transition: top .5s ease, font-size .5s ease;
}
.group {
position: relative;
top: 20px;
margin: 0 auto;
width: max-content;
}
/*
label::after {
content: '';
position: absolute;
top: 5px;
left: 0px;
width: 200px;
height: 23px;
border-radius: 2px;
background: beige;
transition: transform .7s;
transform: scale3d(1, 0.1, 1);
transform-origin: bottom;
}
*/
/*
input:focus + label::after {
top: 5px;
transform: scale3d(1, 1.2, 1);
transition-timing-function: linear;
}
input:focus + label > span {
top: -20px;
font-size: 10px;
}
*/
<body>
<form>
<div class="group">
<input class="input1" type="email" id="email" required />
<label class="label1" for="email">
<span class="sp1">Email</span>
</label>
</div>
</form>
</body>
Give your .group class below css, and you're all set...
.group {
width: max-content;
}
Now label will also move into center...
try this
.sp1{
left : 70px;
}

How should these CSS classes be positioned?

How would you position these CSS classes?
I'm talking about the order from 1st to last. Top to bottom.
Starting with .wrap, ending with .hide.
I just readjusted all of these classes, but which would be a good way line these up?
All help would be greatly appreciated.
Something like this?
https://jsfiddle.net/49ajbhte/35/
<div class="wrape">
<div class="covere" title="OPEN"></div>
<ul class="nav">
.wrape {
position: relative;
width: 266px;
height: 174px;
margin-top: 8px;
overflow: hidden;
}
.covere {
width: 266px;
height: 174px;
background: url("https://i.imgur.com/dCneQvW.png") no-repeat 0 0;
cursor: pointer;
border: 3px solid #0059dd;
box-sizing: border-box;
}
.covere {
display: none;
}
.inactivee .covere {
display: block;
}
.covere::before,
.covere::after {
content: "";
position: absolute;
top: 0;
left: 86px;
width: 3px;
height: 100%;
background: #0059dd;
}
.covere::after {
left: 177px;
}
.nav {
margin: 0;
padding: 0;
list-style: none;
}
.nav li {
float: left;
}
.nav a {
float: left;
width: 50px;
height: 50px;
margin: 0 4px 12px 0;
color: transparent;
background: rgba(0, 0, 0, .2);
border: 3px solid #0059dd;
box-sizing: border-box;
}
.nav a:hover {
border: 3px solid red;
}
.nav li:nth-of-type(5n) a {
margin-right: 0;
}
.nav li:nth-of-type(8) a {
opacity: 0;
}
.nav li:nth-of-type(15) a {
position: relative;
border: 3px solid #0059dd;
background: none;
}
.left-background {
position: absolute;
top: 0;
left: 0;
width: 12px;
height: 100%;
background: rgba(0, 255, 255, 0.5);
}
.left-border {
position: absolute;
top: 0;
left: 12px;
width: 3px;
height: 100%;
background: #0059dd;
}
.middle-background {
position: absolute;
top: 0;
left: 15px;
width: 14px;
height: 100%;
background: rgba(255, 255, 255, 0.5);
}
.right-border {
position: absolute;
top: 0;
left: 29px;
width: 3px;
height: 100%;
background: #0059dd;
}
.right-background {
position: absolute;
top: 0;
left: 32px;
width: 12px;
height: 100%;
background: rgba(255, 0, 255, 0.5);
}
.inactivee a {
display: none;
}
.inactivee .playButtone {
display: none;
}
.activee .playButtone {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
margin: auto;
width: 50px;
height: 50px;
background: rgba(0, 0, 0, .7);
cursor: pointer;
fill: #aaff00;
}
.activee {
background: url("https://i.imgur.com/dCneQvW.png") no-repeat -260px 0;
}
.playe,
.pausee {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 6px;
margin: auto;
}
.pausee {
left: 0;
}
.hide {
display: none;
}
or like this:
https://jsfiddle.net/49ajbhte/33/
<div class="wrape">
<div class="covere" title="OPEN"></div>
<ul class="nav">
.wrap {
position: relative;
width: 266px;
height: 174px;
margin-top: 8px;
overflow: hidden;
}
.nav a {
float: left;
width: 50px;
height: 50px;
margin: 0 4px 12px 0;
color: transparent;
background: rgba(0, 0, 0, .2);
border: 3px solid #0059dd;
box-sizing: border-box;
}
.nav a:hover {
border: 3px solid red;
}
.nav li:nth-of-type(5n) a {
margin-right: 0;
}
.nav li:nth-of-type(8) a {
opacity: 0;
}
.nav li:nth-of-type(15) a {
position: relative;
border: 3px solid #0059dd;
background: none;
}
.nav li:nth-of-type(15) a {
position: relative;
border: 3px solid #0059dd;
background: none;
}
.left-background {
position: absolute;
top: 0;
left: 0;
width: 12px;
height: 100%;
background: rgba(0, 255, 255, 0.5);
}
.left-border {
position: absolute;
top: 0;
left: 12px;
width: 3px;
height: 100%;
background: #0059dd;
}
.middle-background {
position: absolute;
top: 0;
left: 15px;
width: 14px;
height: 100%;
background: rgba(255, 255, 255, 0.5);
}
.right-border {
position: absolute;
top: 0;
left: 29px;
width: 3px;
height: 100%;
background: #0059dd;
}
.right-background {
position: absolute;
top: 0;
left: 32px;
width: 12px;
height: 100%;
background: rgba(255, 0, 255, 0.5);
}
.inactivee a {
display: none;
}
.inactivee .playButtone {
display: none;
}
.covere {
width: 266px;
height: 174px;
background: url("https://i.imgur.com/dCneQvW.png") no-repeat 0 0;
cursor: pointer;
border: 3px solid #0059dd;
box-sizing: border-box;
}
.covere {
display: none;
}
.inactivee .covere {
display: block;
}
.covere::before,
.covere::after {
content: "";
position: absolute;
top: 0;
left: 86px;
width: 3px;
height: 100%;
background: #0059dd;
}
.covere::after {
left: 177px;
}
.nav {
margin: 0;
padding: 0;
list-style: none;
}
.nav li {
float: left;
}
.activee .playButtone {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
margin: auto;
width: 50px;
height: 50px;
background: rgba(0, 0, 0, .7);
cursor: pointer;
fill: #aaff00;
}
.activee {
background: url("https://i.imgur.com/dCneQvW.png") no-repeat -260px 0;
}
.playe,
.pausee {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 6px;
margin: auto;
}
.pausee {
left: 0;
}
.hide {
display: none;
}
According to the html
This comes first
.wrape {
position: relative;
width: 266px;
height: 174px;
margin-top: 8px;
overflow: hidden;
}
Then Cover:
.covere {
width: 266px;
height: 174px;
background: url("https://i.imgur.com/dCneQvW.png") no-repeat 0 0;
cursor: pointer;
border: 3px solid #0059dd;
box-sizing: border-box;
}
Then these would come right before the 'a' anchor tag.
.nav {
margin: 0;
padding: 0;
list-style: none;
}
.nav li {
float: left;
}
Then the 'a' anchor tags would come next:
.nav a {
float: left;
width: 50px;
height: 50px;
margin: 0 4px 12px 0;
color: transparent;
background: rgba(0, 0, 0, .2);
border: 3px solid #0059dd;
box-sizing: border-box;
}
.nav a:hover {
border: 3px solid red;
}
.nav li:nth-of-type(5n) a {
margin-right: 0;
}
.nav li:nth-of-type(8) a {
opacity: 0;
}
.nav li:nth-of-type(15) a {
position: relative;
border: 3px solid #0059dd;
background: none;
}
.left-background {
position: absolute;
top: 0;
left: 0;
width: 12px;
height: 100%;
background: rgba(0, 255, 255, 0.5);
}
.left-border {
position: absolute;
top: 0;
left: 12px;
width: 3px;
height: 100%;
background: #0059dd;
}
.middle-background {
position: absolute;
top: 0;
left: 15px;
width: 14px;
height: 100%;
background: rgba(255, 255, 255, 0.5);
}
.right-border {
position: absolute;
top: 0;
left: 29px;
width: 3px;
height: 100%;
background: #0059dd;
}
.right-background {
position: absolute;
top: 0;
left: 32px;
width: 12px;
height: 100%;
background: rgba(255, 0, 255, 0.5);
}
Then these would come next? but I have no idea why.
.wrape.inactivee a {
display: none;
}
.wrape.inactivee .playButtone {
display: none;
}
Then these would come after that.
.activee .playButtone {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
margin: auto;
width: 50px;
height: 50px;
background: rgba(0, 0, 0, .7);
cursor: pointer;
fill: #aaff00;
}
.activee {
background: url("https://i.imgur.com/dCneQvW.png") no-repeat -260px 0;
}
.playe,
.pausee {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 6px;
margin: auto;
}
.pausee {
left: 0;
}
.hide {
display: none;
}
Both of those work and wont effect your code. However, the first one will keep you from getting lost in your code. Its always good to arrange your html the same as your CSS.

Div is coverd by another and z-index does not work

I'm using Easy-UI layout, the blue part is the "north" layout to show nav, and down that is the layout part of "center".
But the pulldown div is coverd by "center" layout panel when mouse move-on.
I set z-index into pulldown div, but it doesn't work. How can I fix is?
.hd-main .has-pulldown {
cursor: pointer;
position: relative;
*z-index: 10000
}
.hd-main .pulldown {
position: absolute;
cursor: default;
display: none;
top: 30px;
left: 0
}
.hd-main .pulldown .arrow {
*margin-bottom: -1px;
_margin-bottom: 0;
height: 0;
width: 0;
font-size: 0;
line-height: 0;
border-width: 7px;
border-style: solid;
border-color: transparent transparent #F6F6F9 transparent;
_filter: chroma(color=tomato);
_border-color: tomato tomato #F6F6F9 tomato;
position: relative;
display: block;
left: 20px;
z-index: 2
}
.hd-main .pulldown .content {
background: #F6F6F9;
color: #333;
text-align: left;
border-radius: 3px;
border: rgb(175, 175, 175) 1px solid;
border-width: 0 1px 1px 1px;
box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
position: relative;
z-index: 1
}
.hd-main .pulldown-canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
filter: alpha(opacity=0)
}
.hd-main .navs .def-nav,
.hd-main .navs .pulldown-nav,
.hd-main .navs .separate {
display: block;
float: left;
height: 48px;
font: 18px/30px"Microsoft YaHei", "Microsoft JhengHei";
color: #d8d8d8;
text-align: center;
width: 90px;
line-height: 48px
}
.hd-main .navs .pulldown-nav {
position: relative
}
.hd-main .navs .pulldown-nav em {
position: absolute;
display: block;
left: 69px;
top: 18px;
height: 12px;
width: 12px;
font-size: 0;
background-position: -89px -45px
}
.hd-main .navs .pulldown-nav:hover .f-icon,
.hd-main .navs .pulldown-nav:active .f-icon {
position: absolute;
display: block;
right: 11px;
top: 18px;
height: 12px;
width: 12px;
font-size: 0;
background-position: -89px -55px
}
<ul>
<li class="info-i user-name has-pulldown">
<em class="f-icon pull-arrow"></em>
<span class="name top-username">David</span>
<div class="pulldown user-info">
<em class="arrow"></em>
<div class="content">
<span class="li">aa</span>
<span class="li">bb</span>
<span class="li">cc</span>
<span class="li">dd</span>
<span class="separate-li no-height"></span>
<span class="li">Log Out</span>
</div>
</div>
</li>
</ul>