Skip Navigation

[Resolved] Styling labels and custom fields in bootstrap layout

This support ticket is created 5 years 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by samuelH 5 years ago.

Assisted by: Waqar.

Author
Posts
#1419309
css labels and fields.jpg

Hi,
I need to style individual labels and or custom fields placed in bootstrap layout. Could you help me out with some excample code to style individual labels and indvidual custom fields.

#1421771

Hi Samuel,

Thanks for asking! I'd be happy to help.

To check which CSS code is applying to different page elements, you can use Google Chrome's inspect element tool, as explained in this guide:
hidden link

To apply different styles to different labels or any HTML tag in a form, you can assign different IDs to them. For example:


<label id="special-label-green">Label 1</label>
......

<label id="special-label-red">Label 2</label>
......

<label id="special-label-yellow">Label 3</label>
......

These IDs will allow you to assign different styles to these labels. For example:


#special-label-green {
color: green;
}

#special-label-red {
color: red;
}

#special-label-yellow {
color: yellow;
}

Here are some useful tutorials on using ID and class selectors:
hidden link
hidden link

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1423113

Hi,
I also need some help regarding styling cred fields within bootstrap columns. I would like to make radiobuttons inline within one particular column, but leave them as block in another.

May I wrap the credfield in a div?

#1424663

Hi Samuel,

Thanks for writing back and your understanding is correct.

As can be seen in the screenshot you shared earlier, each field's shortcode is already wrapped inside a div container of its own, with class "form-group" (and some class for the Bootstrap's grid).

Screenshot: hidden link

You can include additional class names into these div tags to style them differently.

Tip: Bootstrap library offers built-in class "form-check-inline" to show inline checkboxes and radio elements:
hidden link

Example of a form field with inline radion buttons:


<div class="form-group form-check-inline">
	<label for="wpv-wpcf-field-slug">[wpml-string context="wpv-views"]Field[/wpml-string]</label>
	Field shortcode
</div>

regards,
Waqar

#1427715

My issue is resolved now. Thank you!