Forums › Forums › Search & Filter Pro › Customizing my checkboxes
Tagged: checkboxes, css, Customizing
- This topic has 10 replies, 2 voices, and was last updated 6 years, 3 months ago by Anonymous.
-
Anonymous(Private) August 28, 2018 at 11:29 am #186558
Hello!
First of all, thanks you for this plugin: it’s quite what I needed.I would like to customize the appearance of checkboxes, so that those on this page look like those of this one.
I imagine this is a small setting to make in the style.css file, but I can not find which one. Could you give me a hand?
If it helps, I use this theme and here is my css code:
.searchandfilter ul { padding: 0px; -webkit-columns: 200px 3; -moz-columns: 200px 3; columns: 200px 3; text-align: right; column-gap: 40px; } .searchandfilter > ul > li { padding: 2px 0; } .searchandfilter .checkboxes { position: relative; padding-left: 30px; margin-bottom: 5px; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .searchandfilter .checkboxes input { position: absolute; opacity: 0; cursor: pointer; } .searchandfilter .checkmark { position: absolute; top: 4px; left: 2px; height: 16px; width: 16px; background-color: #eee; border-radius: 4px; } .searchandfilter .checkboxes:hover input ~ .checkmark { background-color: #f8f8f8; } .searchandfilter .checkboxes input:checked ~ .checkmark { background-color: transparent; } .searchandfilter .checkmark:after { content: ""; position: absolute; display: none; } .searchandfilter .checkboxes input:checked ~ .checkmark:after { display: block; } .searchandfilter .checkboxes .checkmark:after { left: 5px; top: -3px; width: 9px; height: 17px; border: solid #5EB28F; border-width: 0 3px 3px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); } .searchandfilter .count { font-weight: normal; font-size: smaller; color: #888888; }
And:
<div class="searchandfilter"> <ul><li><label class="checkboxes">One <span class="count">(1)</span><input type="checkbox" checked="checked"><span class="checkmark"></span></label></li> <li><label class="checkboxes">Two <span class="count">(2)</span><input type="checkbox"><span class="checkmark"></span></label></li> <li><label class="checkboxes">Three <span class="count">(3)</span><input type="checkbox"><span class="checkmark"></span></label></li> <li><label class="checkboxes">Four <span class="count">(4)</span><input type="checkbox"><span class="checkmark"></span></label></li> <li><label class="checkboxes">Five <span class="count">(5)</span><input type="checkbox"><span class="checkmark"></span></label></li> <li><label class="checkboxes">Six <span class="count">(6)</span><input type="checkbox"><span class="checkmark"></span></label></li> <li><label class="checkboxes">Seven <span class="count">(7)</span><input type="checkbox"><span class="checkmark"></span></label></li> <li><label class="checkboxes">Eight <span class="count">(8)</span><input type="checkbox"><span class="checkmark"></span></label></li> <li><label class="checkboxes">Nine <span class="count">(9)</span><input type="checkbox"><span class="checkmark"></span></label></li> <li><label class="checkboxes">Ten <span class="count">(10)</span><input type="checkbox"><span class="checkmark"></span></label></li> <li><label class="checkboxes">Eleven <span class="count">(11)</span><input type="checkbox"><span class="checkmark"></span></label></li> <li><label class="checkboxes">Twelve <span class="count">(12)</span><input type="checkbox"><span class="checkmark"></span></label></li> <li><label class="checkboxes">Thirteen <span class="count">(13)</span><input type="checkbox"><span class="checkmark"></span></label></li> <li><label class="checkboxes">Fourteen <span class="count">(14)</span><input type="checkbox"><span class="checkmark"></span></label></li> <li><label class="checkboxes">Fifteen <span class="count">(15)</span><input type="checkbox"><span class="checkmark"></span></label></li> </ul> </div>
Thanks!
Trevor(Private) August 28, 2018 at 12:21 pm #186563Hi
It is a little complex, but this will give you the idea:
.searchandfilter input.sf-input-checkbox[type=checkbox] + .sf-label-checkbox:before { content:""; display:inline-block; top: -3px; width: 9px; height: 17px; margin-right: 10px; } .searchandfilter input.sf-input-checkbox[type=checkbox]:checked + .sf-label-checkbox:before { border: solid #5EB28F; border-width: 0 3px 3px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); } .searchandfilter input.sf-input-checkbox { display: none; }
Anonymous(Private) August 30, 2018 at 4:01 pm #186816Thank you for your answer.
It works well when checkboxes are checked… but they are not visible otherwise. I guess it’s a matter of a few more css lines, but my attempts failed.Could you help me?
Anonymous(Private) August 30, 2018 at 5:02 pm #186832A gray square, as on this page.
Here is my code:.test-checkboxes .checkmark { position: absolute; top: 4px; left: 2px; height: 16px; width: 16px; background-color: #eee; border-radius: 4px; cursor: pointer; } .test-checkboxes .checkboxes:hover input ~ .checkmark { background-color: #f8f8f8; }
Anonymous(Private) August 30, 2018 at 10:04 pm #186869Maybe the gray squares are too light (#eee). I made them red now:
The green tick is ok. I would like the unchecked boxes to be gray/red on this page.
Trevor(Private) August 31, 2018 at 1:26 pm #186912Is this more like you want?
.searchandfilter input.sf-input-checkbox[type=checkbox] + .sf-label-checkbox:before { content:""; display:inline-block; top: -3px; width: 0px; height: 0px; margin: 0 8px 0 -5px; cursor: pointer; border: 8px solid red; border-radius: 3px; top: 2px; position: relative; } .searchandfilter input.sf-input-checkbox[type=checkbox]:checked + .sf-label-checkbox:before { top: 0; margin: 0 10px -2px 0; width: 9px; height: 17px; border: solid #5EB28F; border-width: 0 3px 3px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); cursor: pointer; border-radius: 0; } .searchandfilter input.sf-input-checkbox { display: none; }
-
AuthorPosts