0

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.

Maik Lowrey
  • 10,972
  • 4
  • 14
  • 43
Sai Krishnadas
  • 1,717
  • 3
  • 18
  • 42

2 Answers2

-1

you can try it

 <div className="font-bold text-2xl text-white border-2 border-black">
    Hello
  </div>
  • That bring border around the text like a div. But need a text outlined in black – Sai Krishnadas Dec 28 '21 at 07:44
  • i think that in addition `outline-4` you must also leave the `outline` – mohamad_sdg Dec 28 '21 at 07:50
  • I think he is asking for an outline to follow the text, like a 'stroke' setting in photoshop. NOT to add a border to the div that contains the text... I wasn't able to find a solution for tailwind, but this answer worked for me: https://stackoverflow.com/questions/2570972/css-font-border – Hazy Jan 27 '22 at 00:11
-1

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>
Maik Lowrey
  • 10,972
  • 4
  • 14
  • 43