3
You can use transform: rotate(270deg)
to move the text vertically according to the image.
3
5
You can use transform: rotate(270deg)
to move the text vertically according to the image.
4
Outside the Rotate (which will modify the entire div) if you just want to change the writing, without affecting the background
, border
and spacing, you can use the writing-mode
.
comes by default as horizontal-tb
, and you will have the following options:
The contents go horizontally from left to right and vertically from top to bottom. The next horizontal line is positioned below the previous line.
.foo { writing-mode: horizontal-tb; }
<div class="foo">
Olá mundo novo!<br>
Quebra de linha
</div>
The contents go vertically from top to bottom and horizontally from right to left. The vertical line to the side is positioned to the left of the previous line.
.foo { writing-mode: vertical-rl; }
<div class="foo">
Olá mundo novo!<br>
Quebra de linha
</div>
The contents go vertically from top to bottom, horizontally from left to right. The next vertical line is positioned to the right of the previous line.
.foo { writing-mode: vertical-lr; }
<div class="foo">
Olá mundo novo!<br>
Quebra de linha
</div>
There is also the property direction
, that supports the values ltr
(left to right) and rtl
(right to left), but this is usually used for texts with characters from different lineages (which may be useful if combined with unicode-bidi: bidi-override;
).
Without unicode-bibi
:
.foo { direction: ltr; }
.baz { direction: rtl; }
<div class="foo">Olá mundo novo!</div>
<div class="baz">Olá mundo novo!</div>
With unicode-bidi
:
.foo {
direction: ltr;
unicode-bidi: bidi-override;
}
.baz {
direction: rtl;
unicode-bidi: bidi-override;
}
<div class="foo">Olá mundo novo!</div>
<div class="baz">Olá mundo novo!</div>
Note that there are still the
sideways-rl
andsideways-lr
(probably was the one you needed), but are experimental and not supported by all browsers.Note also that the values
lr
,lr-tb
,rl
andtb-rl
are in disuse, but are still supported by SVG1 or older browsers:
Pretty cool too!
2
Another suggestion.
.textovertical{
width:1px;
word-wrap: break-word;
font-family: monospace;
white-space: pre-wrap;
}
<p class="textovertical">
Olá esse é um texto vertical !
</p>
Good tbm, I just saw that I will need something like this also soon rs
Yeah, it’s different at first than you ask, but if you need to use it for vertical written languages, there you go...
Browser other questions tagged html css
You are not signed in. Login or sign up in order to post.
Thanks @Raimundonorberto, it worked here with 270deg
– Raylan Soares
Sorry, wrong value, I’ll fix... =)
– Raimundo Norberto