Vertical text in IE7, IE8, IE9, and IE10 with CSS only

后端 未结 3 1908
南旧
南旧 2021-02-02 00:35

Does anyone know how to successfully implement vertical text in IE7, IE8, IE9, and IE10 with CSS only? (by vertical text, I\'m referring to text being rotated counterclockwise

3条回答
  •  再見小時候
    2021-02-02 01:21

    Here is pure CSS ( + 1 extra div for every text ) solution

    Works for all IE versions IE7-10

    /** 
     * Works everywere ( IE7+, FF, Chrome, Safari, Opera )
     */
    .rotated-text {
        display: inline-block;
        overflow: hidden;
        width: 1.5em;
    }
    .rotated-text__inner {
        display: inline-block;
        white-space: nowrap;
        /* this is for shity "non IE" browsers
           that doesn't support writing-mode */
        -webkit-transform: translate(1.1em,0) rotate(90deg);
           -moz-transform: translate(1.1em,0) rotate(90deg);
             -o-transform: translate(1.1em,0) rotate(90deg);
                transform: translate(1.1em,0) rotate(90deg);
        -webkit-transform-origin: 0 0;
           -moz-transform-origin: 0 0;
             -o-transform-origin: 0 0;
                transform-origin: 0 0;
       /* IE9+ */
       -ms-transform: none;
       -ms-transform-origin: none;
       /* IE8+ */
       -ms-writing-mode: tb-rl;
       /* IE7 and below */
       *writing-mode: tb-rl;
    }
    .rotated-text__inner:before {
        content: "";
        float: left;
        margin-top: 100%;
    }
    
    /* mininless css that used just for this demo */
    .container {
      float: left;
    }
    

    HTML example

    
    
    
    
    JS Bin
    
    
      
    Easy
    Normal
    Hard

    source: https://gist.github.com/obenjiro/7406727

提交回复
热议问题