CSS on CB Content Bot fields

7 years 10 months ago #283555 by villy
CSS on CB Content Bot fields was created by villy
Hi all

I am testing CB Content Bot and it works fine!
Trying to apply some css on cb fields that I have added in an article, I found (in plugin configuration Advanced tab) CSS: Optionally input substitution supported CSS to be added to page header (e.g. body {background-color: red}

I have tried : [cb_location] {color: #ededed} but it didn’t work.
What have I done wrong?

Thanks

Please Log in to join the conversation.

7 years 10 months ago - 7 years 10 months ago #283557 by krileon
Replied by krileon on topic CSS on CB Content Bot fields

I have tried : [cb_location] {color: #ededed} but it didn’t work.

That's not a valid selector. You'd end up with something like the following.

home {color: #ededed}

This assumes cb_location value is "home". So cb_location needs to be stored as a valid CSS selector you need to make it a valid selector on output. Example as follows.

.[cb_location] {
    color: #ededed
}

Don't really recommend this though as fields are typically user supplied values. If it's a dropdown where you've full control of what value is stored in the database it should be safe or having strict validation rules on a text field might also be ok.

What exactly are you wanting to accomplish with this? That parameter basically just adds new CSS to the header of any page it's loaded on.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: villy

Please Log in to join the conversation.

7 years 10 months ago #283567 by villy
Replied by villy on topic CSS on CB Content Bot fields
I wanted to have all fields I display using Content Bot to be in diferent color that the text of the article and maybe stong as well.

Please Log in to join the conversation.

7 years 10 months ago #283570 by krileon
Replied by krileon on topic CSS on CB Content Bot fields
You need to surround your substitutions with a CSS class attached to a span for example then style that class. Using [FIELD_NAME] outputs the raw value, there's no CSS class or anything of the sort for CSS to target and style.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: villy

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.217 seconds

Facebook Twitter LinkedIn