Search code examples
csstransformrotatetransform

How to change dimensions with Vertical Text using Transform Rotate


How do I rotate the text vertically and change the dimensions of the border at the same time?

Using "display: inline-block;" will scrunch everything into 1 column.

http://jsfiddle.net/d3ud6/8/

/*display: inline-block;*/
overflow:hidden;
white-space:nowrap;
width:1.5em;
height: 1.5;
transform: rotate(270deg);
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-ms-transform: rotate(270deg);
-o-transform: rotate(270deg);

Solution

  • You can put the text inside a div and rotate it. Then set the border of the columns as you wish (see updated fiddle):

    #rotate th div {
        white-space:nowrap;
        width: 20px;
        transform: translate(0px, 60px) rotate(270deg);
        -webkit-transform: translate(0px, 60px) rotate(270deg);
        -moz-transform: translate(0px, 60px) rotate(270deg);
        -ms-transform: translate(0px, 60px) rotate(270deg);
        -o-transform: translate(0px, 60px) rotate(270deg);
    }
    #rotate th {
        border: 1px solid green;
        height: 150px;
        max-width: 1.5em;
        overflow: hidden;
    }