skip to Main Content

I have the following code:

<h2>
  Where ever you go <br/> i am there.
</h2>

On mobile screens I dont want the <br/> to enforce line break. Any idea how to achieve this using Tailwind CSS?

I tried using multiple code blocks but that feels like repetitive code and hurts SEO.

2

Answers


  1. You can add class to <br> tag.

    In tailwind, <br class="hidden sm:inline" />

    https://play.tailwindcss.com/4koqbTma3P

    Login or Signup to reply.
  2. Its better solution to fixed your issue :

    <h2 className="sm:whitespace-nowrap">
      Where ever you go <br className="sm:hidden" /> I am there.
    </h2>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search