Tagged: cornerstone
-
AuthorPosts
-
November 18, 2016 at 3:48 pm #1262983
Hello, X Team!
I want to add check boxes to my page and I started testing. I want an empty square box when unchecked and check mark inside when checked.
I added Text element to the section and the following HTML to the text area:
<div class=”checkboxFive”>
<input type=”checkbox” value=”1″ id=”checkboxFiveInput” name=”” />
<label for=”checkboxFiveInput”></label>
</div>
Then I added the folowing custom CSS:.checkboxFive {
width: 25px;
margin: 20px 100px;
position: relative;
}
.checkboxFive label {
cursor: pointer;
position: absolute;
width: 25px;
height: 25px;
top: 0;
left: 0;
background: #eee;
border:1px solid #ddd;
}
.checkboxFive label:after {
opacity: 0;
content: ”;
position: absolute;
width: 9px;
height: 5px;
background: transparent;
top: 6px;
left: 7px;
border: 3px solid #333;
border-top: none;
border-right: none;transform: rotate(-45deg);
}
/**
* Create the hover event of the tick
*/
.checkboxFive label:hover::after {
opacity: 0.5;
}/**
* Create the checkbox state for the tick
*/
.checkboxFive input[type=checkbox]:checked + label:after {
opacity: 1;
}Hover state works fine, but checked state does not work. Could you please tell me what am I doing wrong?
Thank you very much for your help,
JaneNovember 18, 2016 at 3:50 pm #1262984Thanks for writing in! To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.
November 19, 2016 at 10:56 am #1263664This reply has been marked as private.November 19, 2016 at 9:44 pm #1263997Hello There,
Thanks for providing the information. Regretfully we have logged because it seems that you forgot to give the username. In the meantime, instead of using a text element, please use the raw content element instead.
Please let us know how it goes.
November 20, 2016 at 10:53 am #1264373This reply has been marked as private.November 20, 2016 at 3:14 pm #1264559Hi there,
Remove the line breaks or
<br>
and it will work. The + sign means select label element next to it, but it the <br> element is next to your checkbox and not the label.Cheers!
November 21, 2016 at 9:06 am #1265499Thank you so much, Rad! It worked!
Thank you X team for the great support you provide!
Jane
November 21, 2016 at 9:16 am #1265512Glad to hear it Jane and thanks for your kind words.
Joao
-
AuthorPosts