有没有一种方法来设置整列的文本对齐方式在一个表中? [英] Is there a way to set the text alignment of entire column in a table?

查看:117
本文介绍了有没有一种方法来设置整列的文本对齐方式在一个表中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种简单的方法,所有的细胞在第二列的文本对齐方式设置为右键

Is there a simple way to set the text alignment of all cells in the second column to right?

或者说是唯一的办法是设置对齐列中每个单元格?

Or is the only way is to set the alignment for each cell in the column?

(不幸的是,没有在Firefox支持的 COL 标记的调整属性。)

(Unfortunately, the align attribute of the col tag is not supported in Firefox.)

推荐答案

一类添加到每个细胞中的第2列。

Add a class to every cell in the 2nd column.

.second {
   text-align: right;
}

您也可以使用CSS3。

You could also use CSS3.

tr td:nth-child(2) { /* I don't think they are 0 based */
   text-align: right;
}

(它不会工作与< = IE8)

(It won't work in <= IE8)

这篇关于有没有一种方法来设置整列的文本对齐方式在一个表中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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