与colspan =“2”连接的表数据的中心文本与.css“选择具有属性colspan =“2”的td。 “, [英] center text of table data connected with colspan="2" with .css " Select td with attribute colspan="2" "

查看:177
本文介绍了与colspan =“2”连接的表数据的中心文本与.css“选择具有属性colspan =“2”的td。 “,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有一个表格,其中一行中的某些列与 colspan =2属性相关联。

Hi I have a table where certain columns in a row are connected with the colspan="2" attribute.

目前看起来像这样:

我希望一行中连接的列的文本居中,而只显示连接列中的文本

I want that the text of the connected columns in a row is centered, but only the text in the connected columns

此行的表数据(无限制)具有以下代码

The table data of this row (unlimited ) has the following code

<tr class="row-4 even">    
<td colspan="2" class="column-3 footable-last-column" style="display: table-cell;">unlimited</td>
</tr>

我无法更改表的代码,因为它是由Wordpress插件自动创建的 tablepress

I can not change the code of the table because it is automatically created by the Wordpress plugin tablepress

我可以做的是添加一个自定义的.css文件。

What I can do is to add a custom .css file.

我的问题是,如果可以用.css只选择属性为
colspan =2的表数据,可以对属性 colspan =2

My Question is, if it is possible to select only the table data with the attribute colspan="2" with .css, so that I can do { text-align: center } only for table data with the attribute colspan="2"

推荐答案

CSS选择器 [attribute =value] 因此您应该添加

The CSS selector [attribute="value"] is what you want, so you should add

tr [colspan="2"] {
    text-align: center;
}

它应该做你想要的。
这个工作非常好

and it should do what you want. This works perfectly fine

这篇关于与colspan =“2”连接的表数据的中心文本与.css“选择具有属性colspan =“2”的td。 “,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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