Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] how to set a field to different colour in list

  • hicksan
  • hicksan
  • OFFLINE
  • Posts: 28
  • Thanks: 1
  • Karma: 0
8 years 4 months ago - 8 years 4 months ago #282366 by hicksan
I have two fields - usually empty - that I would like to be in a different colour (red) if displayed in a list. Please advise how to do this.
Last edit: 8 years 4 months ago by krileon. Reason: Added [SOLVED] tag to subject

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
8 years 4 months ago #282386 by krileon
Use CSS, all fields have a unique ID or class added to their field row. Right click and inspect the field on your userlist and review its classes or ID carefully. Example as follows.

Code:
.cbUserListFL_FIELD_NAME { background-color: red; }


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.

Please Log in or Create an account to join the conversation.

  • hicksan
  • hicksan
  • OFFLINE
  • Posts: 28
  • Thanks: 1
  • Karma: 0
8 years 4 months ago #282394 by hicksan
Which .css file and where do I find it and how?

I tried looking in the Joomla template editor but that only has template.css within my site's adopted style file.

The change I am after is:

.cbUserListFL_FIELD_NAME {
color: red;
}

I added your code to template.css, and added the ".cbUserListFL_FIELD_NAME" to the css box in the field definition but it made no difference.

Sorry but tutorial #31 didn't show how to find the css file. Scrabbling around here.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
8 years 4 months ago #282411 by krileon

Which .css file and where do I find it and how?

Custom CSS should be added to your Joomla template CSS file. Typically your Joomla template should have a way of supplying custom css either in custom.css or override.css, but that's entirely dependent on what template you're using.

I added your code to template.css, and added the ".cbUserListFL_FIELD_NAME" to the css box in the field definition but it made no difference.

You need to change FIELD_NAME to the name of your field. It is not a literal working example.


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.

Please Log in or Create an account to join the conversation.

  • hicksan
  • hicksan
  • OFFLINE
  • Posts: 28
  • Thanks: 1
  • Karma: 0
8 years 4 months ago #282430 by hicksan
Thanks Kyle - that worked beautifully.

May I suggest one of Nick's brilliant tutorials to illustrate for us newbies this exact problem as a starter in .CSS field formatting.

I have to say this is a brilliant product!

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
8 years 4 months ago #282433 by krileon
There's thousands of resources online for learning CSS. We've no plans to provide one our self. CB styling, Joomla styling, etc.. it's all CSS basics. So any resources like the below can help learn CSS quite effectively.

www.w3schools.com/css/default.asp

developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started

Where you put the CSS is basically the only specific thing to the platform. For that I always recommend in your Joomla template. Especially if your template provides a parameter to supply it or supports a custom CSS file being loaded as it removes the risk of upgrades causing your changes to be lost. We can't really make a tutorial for this either as it entirely depends on your template.

Finding a CSS class or ID is done using your browsers developer console. This is typically opened by pressing F12 or right clicking an element on the page then clicking inspect in the context menu.


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: nant, hicksan

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum