I have a CMS collection with a plain text custom field called “Agency credits”. Here’s what it looks like with data:
When I link it to a paragraph field, or as a list item, it comes in as one long sentence:
Do I need to change the custom field to rich text, or something else?
Or do I need to use a different element?
Or do I need to make a custom field for each line?
Here is my public share link:
March 24, 2023, 8:30pm
All of those options work. Plain text doesn’t emit line breaks as HTML
<br>'s, but they remain as line breaks in the content.
The way to get them to display in the browser is to use an element that supports line breaks, like an HTML
<pre> element. You can do that with custom code;
However the text will be fully pre-formatted, using a monospaced font, and isn’t ideal to style in the designer since
<pre> is not a designer-supported element.
A better option is probably to use a rich text field, and bind it to a rich text element that you can style exactly the way you want.
Rich text worked! Do you know how to adjust the spacing between lines? Reducing the line height has no effect:
A workaround in case that’s not possible — using a “soft return” within each CMS item:
March 24, 2023, 9:20pm
Everything you need is in the Webflow U. The RTE has a lot of styling capability so best to read up and watch some videos too to understand the basic techniques.
Yeah I watched that video and read the article. Heck, I’m devouring every video I can find. But it doesn’t cover this issue (line height).
March 24, 2023, 10:16pm
It does, you just have to find the right thing you’re trying to affect. Most likely that’s paragraph margins.
Oh great! Can you tell me what I’m doing wrong?
Screencast - 2023-03-25 - 0:17
All the elements in the rich text need to be styled separately.
If the text within the rich text are paragraphs, u need to select paragraphs within the rich text class which in your case is ‘word credits’ and then provide the line height and font size as per your design.
The best way to do this is to style the Rich Text Element separately in a non cms page. Most people do it within a Style Guide page and then apply the same class within a cms page.
Hope this is helpful.