Line Length Character Limit

Hi everyone, I am just starting to learn CSS.

How would I implement the following in Velo using the highlighted (in red) text ID?

I am trying to set a line character limit for a paragraph.

Unable to understand what you mean.

On Wix website, there is no CSS code required.

You can add a text input element and drag the width of the element to control that.

Text id is irrelevant when setting the “line length”.

Please learn more Velo use case by browsing the examples: https://www.wix.com/velo/examples

Hi,
If you want to set a paragraph width based on ch units , you can do the followings:

  1. On the editor drag the text element to have width wider than the max width needed (if you’re using EditorX, set the element to: Max Content).

  2. Make it hidden on load

  3. Use the following code:

$w.onReady(() => {
 $w('#text223').html = `<p style="width:40ch">${$w('#text223').text}</p>`;
 $w('#text223').show();
})

Thank you so much! If you wouldn’t mind extending an olive branch, seeing how this code is set up, if I wanted to have the text element have a font size of 12 vw, would it be the following?

$w . onReady (() => {
$w ( ‘#text223’ ) .html = ** <p style=" font-size:12vw ">${$w('#text223').text}</p> ** ;
$w ( ‘#text223’ ). show ();
})

Yes. That should work.

I have two follow-up questions regarding this. I figured I’d make a separate forum post for them so that if you are able to provide insight, your answer would count as another ‘best answer.’

Here is the post: https://www.wix.com/velo/forum/coding-with-velo/line-character-limit-code-causes-a-loss-in-paragraph-centering

Cheers!