Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS Display letters horizontally and add space between words

Tags:

html

css

frontend

I'm wanna make the letters of two words display vertically, from top to bottom and, to add a controllable space(a kind of padding-top) on the the last word.(See below image)

letter-direction: vertically

(In Photoshop, you obtain the above effect by pressing Shift + Enter after a letter.)


I obtained something close, but somebody might know a better solution.
My solution:

<p>Stalk &nbsp; Me</p>

<!-- &nbsp; is a HTML space entity -->

p {
    font-size      : 20px;
    width          : 28px;       /* depends on font-size */
    line-height    : 20px;       /* depends on font-size */
    word-wrap      : break-word;
    text-transform : uppercase;
    text-align     : center; 
}

Live example: https://jsbin.com/sacimo/edit?html,css,output


Can somebody help me?

Thank you!

like image 844
Marian07 Avatar asked Jan 30 '16 19:01

Marian07


People also ask

What helps in controlling the horizontal spacing between characters of text?

The letter-spacing CSS property sets the horizontal spacing behavior between text characters.


1 Answers

You can do this with text-orientation: upright and writing-mode: vertical-rl. Add -webkit- and -ms- Browser vendor prefixes if needed like this Demo.

p {
  writing-mode: vertical-rl;
  text-orientation: upright;
  text-transform: uppercase;
  font-weight: bold;
}
<p>Stalk Me</p>
like image 155
Nenad Vracar Avatar answered Sep 28 '22 03:09

Nenad Vracar