2

So for some reason i'm not able to create a broken line inside the paragraph such that I can get a new line... I'm using tailwind with react.

<p className="mt-3 text-base text-gray-300 sm:mt-5 sm:text-xl lg:text-lg xl:text-xl">
Transform the way you interact with your customers. Collect valuable, actionable and credible feedback.</p>

So I've tried all these solutions, but I get errors.

1.

<p className="mt-3 text-base text-gray-300 sm:mt-5 sm:text-xl lg:text-lg xl:text-xl">
    Transform the way you interact with your customers. <br> Collect valuable, actionable and credible feedback.</p>
<p className="mt-3 text-base text-gray-300 sm:mt-5 sm:text-xl lg:text-lg xl:text-xl">
    Transform the way you interact with your customers. <br> Collect valuable, actionable and credible feedback.</br> </p>
<p className="mt-3 text-base text-gray-300 sm:mt-5 sm:text-xl lg:text-lg xl:text-xl">
    Transform the way you interact with your customers. {"\n"} Collect valuable, actionable and credible feedback.</p>
Sermad NaJar
  • 135
  • 1
  • 5
  • 15

3 Answers3

1

Relate to the answer here

Every html tags should be closed, remember this is jsx not html. Every component should be closed.

<br> in jsx ->  <br/>
<input> in jsx -> <input />

You can read about jsx more here

Muhamet Smaili
  • 375
  • 2
  • 9
  • I still get an error when i use the closing tag. – Sermad NaJar Mar 14 '22 at 10:48
  • ```

    Transform the way you interact with your customers.
    Collect valuable, actionable and credible feedback.

    ```
    – Muhamet Smaili Mar 14 '22 at 11:06
  • That should be your example. So if you want to write two breaks inside p just write them

    , you can write as many as you want but closing should happen at the end
    . check If you are doing so, if not please write a sandbox so I can see it, I will kindly help you.
    – Muhamet Smaili Mar 14 '22 at 11:08
0

The first one it's correct, just use a self closing tag so you won't get that error

<p className="mt-3 text-base text-gray-300 sm:mt-5 sm:text-xl lg:text-lg 
xl:text-xl">
Transform the way you interact with your customers. <br/> Collect valuable, 
actionable and credible feedback.</p>
coglialoro
  • 601
  • 1
  • 4
  • 12
0

I have same style worked inside div

  <div className="text-lg text-center font-semibold mt-4">
        Breaking after this 
        <br /> new line
      </div>
Yilmaz
  • 35,338
  • 10
  • 157
  • 202