[英]How to change color of links in a table using CSS but without access to "class" parameter / HTML file?
I am trying to make a complete makeover of a very old website, to which hosting server I do not have access to.我正在尝试对一个非常古老的网站进行彻底改造,我无法访问该托管服务器。 Not only its HTML is from the 1990's, but its code has many obvious mistakes, that when menage to workaround I usually end up messing up other parts of the site
不仅它的 HTML 是 1990 年代的,而且它的代码有很多明显的错误,当我想解决方法时,我通常最终会弄乱网站的其他部分
Right now I need to adjust a table's content.现在我需要调整表格的内容。 That table is also messed up to some extent.
那张桌子在某种程度上也搞砸了。 So is there a way to tell with CSS to color all the links it is holding?
那么有没有办法告诉 CSS 为它所持有的所有链接着色? I would like to apply to those links parameters
我想申请那些链接参数
a:link
a:hover
a:active
a:visited
a:visited:hover
So far I was to only change that table's only non-linked text with到目前为止,我只用
body > center:nth-child(1) > center:nth-child(5) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(7) > b:nth-child(1) > font:nth-child(1)
{
color: #ffffff !important;
}
and change its two only links [aka the rest of its written & visible content] with并用
body > center:nth-child(1) > center:nth-child(5) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(3) > b:nth-child(1) > a:nth-child(1) > font:nth-child(1),
body > center:nth-child(1) > center:nth-child(5) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(5) > a:nth-child(1) > b:nth-child(1) > font:nth-child(1)
{
color: #ff0000 !important;
}
However when I try to extend these two lines of code with something like但是,当我尝试用类似的东西扩展这两行代码时
> a:hover
or rework their end to或返工他们的结局
font:nth-child(1)a:hover
they get reverted to the default color that I am trying to get rid of.它们会恢复为我试图摆脱的默认颜色。 And as I am writing a CSS theme to be used with something like Stylish add-on in Firefox, I cannot touch the code and eg use the >>class<< method [as it was not used in the original HTML].
当我正在编写一个 CSS 主题以与 Firefox 中的 Stylish 插件一起使用时,我无法触摸代码,例如使用 >>class<< 方法 [因为它没有在原始 HTML 中使用]。 And so- is there a way to add >>hover<< [and other variants] to such links?
所以 - 有没有办法将 >>hover<< [和其他变体] 添加到这些链接?
This table is on a minor sub-page - the priority was to make the main page aesthetics, which I did with various parameters for various elements, starting with >>body<< section - and so I Reckon some of those might be transferred to this sub-page.这张表在一个次要的子页面上——首要任务是使主页美观,我对各种元素使用了各种参数,从 >>body<< 部分开始——所以我认为其中一些可能会转移到这个子页面。 But for now this sub-page is the only one with a table [if that somehow helps with making a workaround]
但是现在这个子页面是唯一一个有表格的页面[如果这有助于解决问题]
[I am sorry if I have use the wrong nomenclature, but I am not a programmer - just a small time code tweaker] [如果我使用了错误的命名法,我很抱歉,但我不是程序员 - 只是一个小的时间代码调整器]
And here is the original HTML code:这是原始的 HTML 代码:
<table cellspacing="7" cellpadding="0" border="0" bgcolor="#000000">
<tbody><tr>
<td></td>
<td></td>
<td><b><a href="https://[-FIRST-LINK-]"><font color="#999999">-TEXT-OF-FIRST-LINK-</font></a></b>
</td>
<td></td>
<td>
<a href="mailto:[-SECOND-LINK-]">
<b><font color="#999999">-TEXT-OF-SECOND-LINK-</font></b></a></td>
<td></td>
<td><b><font color="#999999"-TEXT-OF-THE-ONLY-NONLINK-</font></b>
</td>
</tr>
</tbody></table>
The child selector only works for direct descendants.子选择器仅适用于直系后代。 So once you have reached your anchor, you apply the hover, active, focus state.
所以一旦你到达你的锚点,你就应用悬停、活动、焦点状态。
body > center:nth-child(1) > center:nth-child(5) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(3) > b:nth-child(1) > a:nth-child(1):hover > font:nth-child(1),
body > center:nth-child(1) > center:nth-child(5) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(3) > b:nth-child(1) > a:nth-child(1):active > font:nth-child(1),
body > center:nth-child(1) > center:nth-child(5) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(3) > b:nth-child(1) > a:nth-child(1):focus > font:nth-child(1),
body > center:nth-child(1) > center:nth-child(5) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(5) > a:nth-child(1):hover > b:nth-child(1) > font:nth-child(1),
body > center:nth-child(1) > center:nth-child(5) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(5) > a:nth-child(1):active > b:nth-child(1) > font:nth-child(1),
body > center:nth-child(1) > center:nth-child(5) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(5) > a:nth-child(1):focus > b:nth-child(1) > font:nth-child(1) {
color: #00ff00;
}
Not sure if these :nth-child
s, b
and font
selectors are necessary.不确定这些
:nth-child
s、 b
和font
选择器是否必要。
Since I don't know your HTML code, I can't see were to tweak this selector.因为我不知道你的 HTML 代码,所以我看不到要调整这个选择器。
:active
for holding down on the link. :active
用于按住链接。
:focus
when accessed by keyboard or clicking on the link. :focus
通过键盘访问或单击链接时。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.