Vertically & horizontally align text after CSS rotation

后端 未结 2 1081
被撕碎了的回忆
被撕碎了的回忆 2021-01-01 12:04

So I\'m using CSS to rotate some text from horizontal to vertical (90 degrees) like so:

-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
wr         


        
2条回答
  •  佛祖请我去吃肉
    2021-01-01 12:45

    Alternative method, which is more browser compliant and doesn't need information about amount of text beforehand:

    .disclaimer {
        position: absolute;
        right: 10px;
        bottom: 10px;
        font-size: 12px;
        transform: rotate(270deg);
        -ms-transform: rotate(270deg);
        -moz-transform: rotate(270deg);
        -webkit-transform: rotate(270deg);
        -o-transform: rotate(270deg);
        line-height: 15px;
        height: 15px;
        width: 15px;
        overflow: visible;
        white-space: nowrap;
    }
    

    http://jsfiddle.net/d29cmkej/

提交回复
热议问题