Why is the element not centered in the checkbox?
Must be centered exactly in the middle of the checkbox.
when clicked, it should look like this:
https://i.stack.imgur.com/qNb9l.png
Tried:
left: 50%; top: 50%; - does not seem to work.
I do not understand why horizontal scrolling appears when you click on the checkbox.
overflow-x: hidden; - not a solution
Code:
* { box-sizing: border-box; user-select: none; }
section{
display: flex;
flex-direction: column;
padding: 0.5em;
}
input[type='checkbox']{ height: 0; width: 0; }
input[type='checkbox'] + label{
position: relative;
display: flex;
margin: .6em 0;
align-items: center;
color: #9e9e9e;
}
input[type='checkbox'] + label > ins{
position: absolute;
display: block;
bottom: 0;
left: 2em;
height: 0;
width: 100%;
overflow: hidden;
text-decoration: none;
}
input[type='checkbox'] + label > ins > i{
position: absolute;
bottom: 0;
font-style: normal;
color: #000;
}
input[type='checkbox'] + label > span{
display: flex;
justify-content: center;
align-items: center;
margin-right: 0.8em;
width: 1.2em;
height: 1.2em;
background: transparent;
border: 2px solid #E6ECF0;
border-radius: 3px;
cursor: pointer;
transition: all 250ms cubic-bezier(.4,.0,.23,1);
}
input[type='checkbox']:checked + label > ins{ height: 100%; }
input[type='checkbox']:checked + label > span{
border: .5em solid #7726E5;
}
input[type='checkbox']:checked + label > span:before{
content: "";
position: absolute;
box-shadow: inset 0px 0px 0px 5px rgba(0,0,0,0.75);
border-radius: 2px;
}
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Checkbox</title>
<meta name="viewport" content="width=device-width">
</head>
<body>
<section>
<input id='one' type='checkbox' />
<label for='one'>
<span></span>
Off with your head
<ins><i>Off with your head</i></ins>
</label>
<input id='two' type='checkbox' />
<label for='two'>
<span></span>
Dance ’til you’re dead
<ins><i>Dance ’til you’re dead</i></ins>
</label>
<input id='three' type='checkbox' />
<label for='three'>
<span></span>
Heads will roll
<ins><i>Heads will roll</i></ins>
</label>
<input id='four' type='checkbox' />
<label for='four'>
<span></span>
On the floor
<ins><i>On the floor</i></ins>
</label>
</section>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
</body>
</html>
not paying attention: It looks like your post is mostly code; please add some more details.It looks like your post is mostly code; please add some more details.It looks like your post is mostly code; please add some more details.It looks like your post is mostly code; please add some more details.It looks like your post is mostly code; please add some more details.
Aucun commentaire:
Enregistrer un commentaire