2016-10-09 6 views
0

私のHTMLコードをテーブル上で回転させるために時間を費やしていましたが、うまくいかないようです。ここブートストラップを使用して2つのrowspanを使用してテーブルのテキストを回転する方法

は誰も私を助けて喜んであれば、私は

https://jsfiddle.net/zmxr9kyh/

ここに私のhtmlコード

$(function() { 
 
    var header_height = 0; 
 
    $('table th span').each(function() { 
 
    if ($(this).outerWidth() > header_height) header_height = $(this).outerWidth(); 
 
    }); 
 

 
    $('table th').height(header_height); 
 
});
th { 
 
    position: relative; 
 
    padding: 10px; 
 
} 
 
th span { 
 
    bottom: 0; 
 
    display: inline-table; 
 
    left: 50%; 
 
    position: absolute; 
 
    transform: rotate(-90deg); 
 
    transform-origin: 0 50% 0; 
 
    white-space: pre; 
 
    width: 100; 
 
    margin-left: auto; 
 
    margin-bottom: -110; 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<table class="table table-bordered table-hover table-condensed" align="center" border='1'> 
 

 
    <thead> 
 
    <tr> 
 
     <th style="border-bottom-color:#FFFFFF">&nbsp;</th> 
 

 
     <th style="border-bottom-color:#FFFFFF"> 
 

 
     </th> 
 
     <th colspan="12" align="center"> 
 
     <center>VALIDASI</center> 
 
     </th> 
 
     <th style="border-bottom-color:#FFFFFF"> 
 
     <center></center> 
 
     </th> 
 
     <th colspan="6" align="center"> 
 
     <center>JUMLAH RECORD</center> 
 
     </th> 
 
    </tr> 
 
    <tr align="center"> 
 
     <th style="border-bottom-color:#FFFFFF">NO.</th> 
 
     <th style="border-bottom-color:#FFFFFF">PROGRAM STUDI</th> 
 
     <th rowspan="2"><span>IDENTITAS MAHASISWA</span> 
 
     </th> 
 
     <th rowspan="2"> 
 
     <center>%</center> 
 
     </th> 
 
     <th rowspan="2"><span>MAHASISWA PT</span> 
 
     </th> 
 
     <th rowspan="2"> 
 
     <center>%</center> 
 
     </th> 
 
     <th rowspan="2"><span>KURIKULUM</span> 
 
     </th> 
 
     <th rowspan="2"> 
 
     <center>%</center> 
 
     </th> 
 
     <th rowspan="2"><span>NILAI</span> 
 
     </th> 
 
     <th rowspan="2"> 
 
     <center>%</center> 
 
     </th> 
 
     <th rowspan="2"><span>AKM</span> 
 
     </th> 
 
     <th rowspan="2"> 
 
     <center>%</center> 
 
     </th> 
 
     <th rowspan="2"><span>DAYA TAMPUNG</span> 
 
     </th> 
 
     <th rowspan="2"> 
 
     <center>%</center> 
 
     </th> 
 
     <th style="border-bottom-color:#FFFFFF"><span>LAPORAN %</span> 
 
     </th> 
 
     <th colspan="3" align="center"> 
 
     <center>MHS</center> 
 
     </th> 
 
     <th style="border-bottom-color:#FFFFFF"> 
 
     <center> 
 
      KELAS KKULIAH 
 
     </center> 
 
     </th> 
 
     <th rowspan="2"> 
 
     <center>NILAI</center> 
 
     </th> 
 
     <th rowspan="2"> 
 
     <center>AKM</center> 
 
     </th> 
 
    </tr> 
 
    <tr align="center"> 
 
     <th>&nbsp;</th> 
 
     <th>&nbsp;</th> 
 
     <th> 
 
     <center></center> 
 
     </th> 
 
     <th> 
 
     <center>A</center> 
 
     </th> 
 
     <th> 
 
     <center>C</center> 
 
     </th> 
 
     <th> 
 
     <center>N</center> 
 
     </th> 
 
     <th> 
 
     <center></center> 
 
     </th> 
 
    </tr> 
 
    </thead> 
 

 

 
</table>

答えて

1

writing-modeはあなたの友人であることを理解するであろう、jsfiddleです:

th span { 
    writing-mode: tb-rl; 
} 

ベンダープレフィックスを追加する必要があります。あなたの答えのための

+0

感謝。 Jsfiddleは動作しているようですが、私が自分のコードに適用したときにはそうではありません。結果はhttp://imgur.com/a/xDX9dのように表示されます。私はこのテーブルの上に他のテーブルを持っています。たぶんそれが原因ですか? –

+0

JSFiddleで削除したCSSとJSを削除したかどうか再度確認してください。あなたはこれのためにJSを必要とせず、また「thスパン」は絶対に配置されるべきではありません。 –

+0

ワウの仕事はマージンボトムを取り除いて-110;幅:100;あなたの魔法のおかげで –

関連する問題