Home > Blockchain >  Add spaces between each letter of word HTML & CSS
Add spaces between each letter of word HTML & CSS

Time:03-23

I want to add a little space for styling between each letter of my word, I can achieve this by the following:

.space {
  margin-left: 5px;
}
<h1 style="text-align: center"><span >S</span><span >p</span><span >a</span><span >c</span><span >e</span><span >s</span></h1>

But since there is so much copying and pasting, is there a better / more efficient way to do this?

Thanks

CodePudding user response:

Use letter-spacing CSS

h1 {
    letter-spacing: 5px;
}
<h1 style="text-align: center">Spaces</h1>

CodePudding user response:

Use letter-spacing in css

<h1 >Hello</h1>

.space{
 letter-spacing: 5px;
}

CodePudding user response:

.space {
  letter-spacing: 2px;
}
<h1  style="text-align: center">Spaces</h1>

or simply you can add &nbsp; between letters.

  • Related