1

I have a Box and the text i want to show as vertical ,

I used writing-mode : vertical-rl to align it so , as :

Image of box is as

I am trying to get the text to center :

using text-align : center or justify-content : center but nothing worked

Present CSS used is as:

current CSS

I have also gone through few other SO Q's but nothing worked

req O/p :

  • Box size varies dynamically, but text should be aligned at center (for any padding suggestions).. May I know how could i achieve this .. any help is much appreciated , TIA

    req o/p

Codenewbie
  • 1,428
  • 2
  • 12
  • 35

2 Answers2

3

I think you are looking for align-items:

.sapMText {
  display: flex;
  box-sizing: border-box;
  writing-mode: vertical-rl;
  width: 200px;
  border: 1px solid black;
  line-height: normal;
  align-items: center;
  cursor: text;
}
c0deNinja
  • 3,890
  • 1
  • 28
  • 45
1

Put text in span tag <span id="text">text vertical ...</span> and give following style to it :

    #text {
writing-mode : vertical-rl;
margin-left: 50%;}
Amirmasud
  • 21
  • 5