CSS Rotate Text Vertical - Extra Space on both sides

前端 未结 4 414
我在风中等你
我在风中等你 2021-01-19 04:02

When I rotate and inline layer with TEXT, it adds extra space (width of large text) on the rotation, I dont want to fix. What is the best way to avoid extra space (width of

4条回答
  •  渐次进展
    2021-01-19 04:58

    transforms are entirely visual...they do NOT affect the layout of elements. Space is not being added...it's there all the time.

    Consider using writing-mode instead.

    .rotate {
      writing-mode: vertical-rl;
      text-align: center;
      transform:rotate(180deg);
      background: pink;
      height:100vh;
    }

    BACKGROUND

    TITLE

    The writing-mode CSS property defines whether lines of text are laid out horizontally or vertically and the direction in which blocks progress.

    Writing-mode @ MDN

提交回复
热议问题