You are viewing limited content. For full access, please sign in.

Question

Question

Forms - Change Text Color within a Section Title by Class

asked on July 11, 2016 Show version history

Under themes there is an option to change the color of all Section Title Fonts but is there any way to do it by class. For example if the class is blue make it blue, red make it red. Etc?

There is no option to enter classes in the Themes user friendly interface and I can't find any good examples in the customizing a form using CSS documentation in regards to accessing the text within this title. If I try to just change the class color nothing happens.

0 0

Answer

SELECTED ANSWER
replied on July 11, 2016

Hi Chad,

In this example I set the "Red Section" section to have class "red", the "Blue Section" section to have class "blue", etc. I then used the following three CSS rules:

.red .cf-section-header {color: red;}
.blue {color: blue;}
.green > .cf-section-header {color: green;}

In 01-red.png, you can see that the section header is in red, but so is the header for a table under that section. This is because they both have the "cf-section-header" class.

In 02-blue.png, everything in the section, including custom HTML text, is in blue.

In 03-green.png, only the section header and not the table header is in green. The rule above states to apply the green color to only elements with the "cf-section-header" class which are immediate children of elements in the "green" class; there are other elements wrapping the table header so it does not fall under this rule.

In general, there isn't CSS documentation in the Help Files because it's all standard CSS; W3Schools is a good reference, and more advanced tricks can be found in sites like StackOverflow, etc. Your greatest friend in finding the appropriate selectors is in opening Developer Tools (F12) and exploring the DOM of the page to discover the relevant classes, structure of HTML elements, and existing style values at each level.

Hope this helps!

01-red.png
02-blue.png
03-green.png
01-red.png (17.63 KB)
02-blue.png (12.34 KB)
03-green.png (16.31 KB)
3 0

Replies

replied on July 11, 2016

Perfect, that 3rd example is exactly what I was looking for. I was stuck searching w3 for help modifying a section because I knew it was specific to LF Forms. I guess what I need to know is the child element name using the dev tools.

0 0
replied on July 12, 2016

For future reference:

A class is just a developer-designated set of items. When targeting a set of elements with the same class, you don't look for code specific to whatever that class name is: classes are not standardized the way elements types (e.g., div, span, select) are. The developers could have called it "forms-section-labels" instead of  "cf-section-headers" and it would not affect your CSS other than you would use "forms-section-labels" wherever you had "cf-section-headers".

The goal of classes is to provide a way to target a set of items (e.g., section labels, subtitles), where the you can specify what that set of items is. This article on classes and ids might be helpful.

0 0
replied on July 13, 2016

Thanks!

0 0
replied on July 13, 2016

Is this the right syntax? The text remains black in my Chrome browser.

.green > .cf-section-header {color: green;}
.blue > .cf-section-header {color: blue;}
.red > .cf-section-header {color: red;}

0 0
replied on December 24, 2016 Show version history

Hi all, 

I was having similar requirements. Tried the code James provided , but the Section text doesnt change. Iam trying these out in a chrome browser. Is it because of the browser?

 

Any other way to achieve this??

 

Thanks & Regards

Akhil 

0 0
replied on April 4, 2017

Akhil,

Hi, I had the same problem with chrome until I cleared my browser cache/cookies/etc

I know this is an old post.. but did you try that?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.