表格单元格中的竖排文本 [英] Vertical text in table cell

查看:59
本文介绍了表格单元格中的竖排文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何正确设置某些表格单元格以垂直显示文本.

在论坛的一些帮助下,我提出了以下想法:http://jsfiddle.net/hr4tkg9q/

我正在使用以下 jquery:

$(document).ready(function () {$('td.rotate').css('height', $('td.rotate').width());});

问题是,它正确设置了第一列中的垂直文本,但没有正确设置第二列或第三列中的垂直文本.如果您能提供帮助,我们将不胜感激.

解决方案

尝试旋转单元格中的 div 而不是单元格.

<td><div class='rotate'>G

</td>....

更新:

$(document).ready(function () {$('tr').each(函数(){$(this).find('td.rotate').css('height', $(this).find('div.rotate').width());});});

我认为这会帮助你试试这个http://jsfiddle.net/hr4tkg9q/2/

How do I properly set some of the table cell to display text vertically.

with some help in forums I came up this following idea: http://jsfiddle.net/hr4tkg9q/

I am using the following jquery:

$(document).ready(function () {
    $('td.rotate').css('height', $('td.rotate').width());
});

the problem is, it properly sets the vertical text in 1st column but not the second or third one. will appreciate if you can help.

解决方案

try to rotate a div in your cell not the cell.

<tr>
 <td>    
  <div class='rotate'>
   G
  </div>
 </td>

 ....

UPDATE:

$(document).ready(function () {
  $('tr').each( function() {
    $(this).find('td.rotate').css('height', $(this).find('div.rotate').width());
  });   
});

i think this will help you try this http://jsfiddle.net/hr4tkg9q/2/

这篇关于表格单元格中的竖排文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆