2016-10-09 3 views
0

좋아요, 테이블에서 텍스트를 회전시키기 위해 HTML 코드를 작동 시키는데 시간이 많이 걸렸습니다. 그러나 나던 한 것 같습니다. 누군가가 나를 도울 의향이 있다면 여기부트 스트랩을 사용하여 두 rowspan을 사용하여 테이블에서 텍스트를 회전하는 방법

이 jsfiddle, 나는

여기 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 당신의 친구입니다 감사합니다 :

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

공급 업체 접두사를 추가해야 할 수도 있습니다. 답변에 대한 More information

  • Updated JSFiddle
  • +0

    감사합니다. Jsfiddle이 작동하는 것처럼 보였지만 코드에 적용했을 때 그렇지 않습니다. 결과는 http://imgur.com/a/xDX9d와 같이 표시됩니다. 나는이 테이블 위에 다른 테이블을 가지고있다. 어쩌면 그게 원인일까요 ?? –

    +0

    JSFiddle에서 제거한 CSS와 JS를 제거했는지 다시 확인하십시오. 당신은 이것을 위해 어떤 JS도 필요하지 않으며 또한 'th span'은 절대적으로 위치하지 않아야합니다. –

    +0

    와우 효과가 있으며, margin-bottom 제거 : -110; 및 너비 : 100; 당신의 마술에 감사드립니다. –

    관련 문제