Skip Navigation

[Resolved] How to add CSS to a checkbox or other types field?

This support ticket is created 7 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 1.16 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 7 replies, has 2 voices.

Last updated by Minesh 7 years, 10 months ago.

Assisted by: Minesh.

Author
Posts
#402551

Hello!

I need your help! I am trying to add custom css to a checkbox field in a parametric search.

I want to add one like this: hidden link

For example the .slideThree

I am confused, I add the custom css of that ".slidethree", but I am not sure how to put the html in types:

<div class="slideThree">  
      <input type="checkbox" value="None" id="slideThree" name="check" checked />
      <label for="slideThree"></label>
    </div>

I start with that field in my parametric search, but the idea is change other too. How Is the correct way to put the html css with the types checkbox?

#402613

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

You can apply any CSS to your HTML using the CSS Editor in the View itself.
=> https://toolset.com/documentation/user-guides/adding-custom-css-views/

In the View, when you set up your Filter in the Filter Editor, you are presented with many options how to display your Filter. We have some great DOC and Tutorials regarding this:
=> https://toolset.com/documentation/user-guides/getting-started-with-views/projects-parametric-search/
=> https://toolset.com/documentation/user-guides/front-page-filters/
=> https://toolset.com/documentation/user-guides/getting-started-views/part-7-building-a-parametric-search-with-views/

#402789

Hi minesh!

I read that docs, but I don't know how to change the CSS checkboxs in types.

This is the css:

/* .slideThree */
.slideThree {
  width: 80px;
  height: 26px;
  background: #333;
  margin: 20px auto;
  position: relative;
  border-radius: 50px;
  box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);
  &:after {
    content: 'OFF';
    color: #000;
    position: absolute;
    right: 10px;
    z-index: 0;
    font: 12px/26px Arial, sans-serif;
    font-weight: bold;
    text-shadow: 1px 1px 0px rgba(255,255,255,.15);
  }
  &:before {
    content: 'ON';
    color: $activeColor;
    position: absolute;
    left: 10px;
    z-index: 0;
    font: 12px/26px Arial, sans-serif;
    font-weight: bold;
  }
  label {
    display: block;
    width: 34px;
    height: 20px;
    cursor: pointer;
    position: absolute;
    top: 3px;
    left: 3px;
    z-index: 1;
    background: #fcfff4;
    background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
    border-radius: 50px;
    transition: all 0.4s ease;
    box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
  }
  input[type=checkbox] {
    visibility: hidden;
    &:checked + label {
      left: 43px;
    }
  }    
}
/* end .slideThree */

And this the html:

<div class="slideThree">  
      <input type="checkbox" value="None" id="slideThree" name="check" checked />
      <label for="slideThree"></label>
    </div>

I put the css in the css style sheet, Fine.

But could you tell me how to put the HTML in the chechbox from Types? I'm thinks that is different to normal html checkbox.

Could you help me with these example?

#402812

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Unfortunately - to make filter work it needs custom code and this is beyond the scope of our support policy.

If you need custom programming for your project, please feel free to contact our certified partners.
https://toolset.com/consultant/

#402865

But can be done with Types? Can you guide me in the correct way? just for change de CSS of the checkboxes.

Or something more simple: How to change de background color from a select box? To white for example.

Becouse I see that the html sintaxt of a Types fields, is different than normal:

<div class="slideThree">
<input type="checkbox" value="None" id="slideThree" name="check" checked />
<label for="slideThree"></label>
</div>

So I don't know how to put thats values in a typical Types fields.

Could you give with one examples at least? Please.

#403115

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Styling a parametric filter inputs is the same as styling ordinary HTML. Looking at the link you shared with me to style checkbox, It depends on your expectation and functionality you are expecting. If you are just getting started with parametric filters and its styling. I suggest you will read this tutorial:
https://toolset.com/documentation/user-guides/front-page-filters/

For styling, please scroll down on that tutorial to "Styling Parametric Search Forms". The technique is to give your HTML elements the necessary classes or IDs so you can easily style them with CSS. You will find the example under the section "Styling Parametric Search Forms".

wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="idoc-properties-search">
    <div class="sbox">
        <label>City</label>
        [wpv-control field="city" url_param="city"]
    </div>
    <div class="sbox">
        <label>State</label>
        [wpv-control field="state" type="select" values=" ,NY,CA,IL,FL,WA" display_values=" ,NY,CA,IL,FL,WA" url_param="state"]
    </div>
    <div class="sbox">
        <div class="one_half">
            <label>SQ FT From</label>
            [wpv-control field="squarefeet" url_param="sqfeetmin"]
        </div>
        <div class="one_half">
            <label>SQ FT To</label>
            [wpv-control field="squarefeet" url_param="sqfeetmax"]
        </div>
    </div>
    <div class="sbox checkbox">
        <label>Bedrooms</label>
        [wpv-control field="bedrooms" type="checkboxes" values="1,2,3,4,5,6" display_values="1,2,3,4,5,6" url_param="beds"]
    </div>
    <div class="sbox">
        <div class="one_half">
            <label>Price Min</label>
            [wpv-control field="price" type="select" values=",100000,200000,300000,400000,500000,600000,700000" display_values=",$100 000,$200 000,$300 000,$400 000,$500 000,$600 000,$700 000" url_param="pricemin"]
        </div>
        <div class="one_half">
            <label>Price Max</label>
            [wpv-control field="price" type="select" values=",100000,200000,300000,400000,500000,600000,700000" display_values=",$100 000,$200 000,$300 000,$400 000,$500 000,$600 000,$700 000" url_param="pricemax"]
        </div>
    </div> 
    <div class="sbox last">
        [wpv-filter-submit name="Search"]
    </div>
    <div>
[/wpv-filter-controls]
[wpv-filter-end]

Please note that with the example code we have wrapped each of the controls (radio buttons, checkboxes) in divs with assigned classes , e.g. "sbox", "one_half". These are used in CSS styling.

However, we cannot exactly provide the actual custom CSS code that will provide the output based on your screenshot. We can only give advice on best practices/tips. If you want to know the exact CSS code that will output based on that screensot. Please contact our certified partners for help:
=> https://toolset.com/consultant/

Even you can play with our reference sites which is the best place to learn and try new things.
=> https://toolset.com/faq/how-and-why-to-create-a-test-site-in-discover-wp/

You can find sites with search form and learn how search form is styled.
=> http://discover-wp.com/site-templates/
=> hidden link

Refer to section "Step 7: Styling the search form"
=> https://toolset.com/documentation/user-guides/getting-started-views/part-7-building-a-parametric-search-with-views/
=> https://toolset.com/documentation/user-guides/getting-started-views/

Now - to style checkboxes if you use taxonomy as checkbox the HTML structure is different and when you use custom field as checkbox again HTML structure is different. Please contact our certified partners for help:
=> https://toolset.com/consultant/

This is all I've to offer you. Thank you.

#403161

Ok! thanks you for answer! Do you know when will be finished the VC integrated version? And if it's going to be integrated with the filter section too?

#403333

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes - VC integration with views filter box is on our roadmap and it will be integrated in near future.

For VC integration with content templates - You can know more here:
https://toolset.com/2016/05/toolset-2-1-preview-visual-composer-integration-content-templates/

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.