Home > Software design >  How to have a bordered text in tailwind
How to have a bordered text in tailwind

Time:12-29

I need the text to have a black border.

I tried this,

  <div className="font-bold text-2xl text-white outline-4">
    Hello
  </div>

But it doesn't seem put a border to the text.

CodePudding user response:

you can try it

 <div className="font-bold text-2xl text-white border-2 border-black">
    Hello
  </div>

CodePudding user response:

Two ways to do that for you case.

  1. you change the div to an inline element or
  2. you wrap the text with a inline element. e.g span
  <div className="inline font-bold text-2xl text-white outline-4 border-2 border-black">
    Hello
  </div>
  <div className="font-bold text-2xl text-white ">
     <span className="outline-4 border-2 border-black">Hello</span>
  </div>
  • Related