使用:nth-of-type创建空偶数元素 [英] Using :nth-of-type creates empty even elements
问题描述
我在结果div中显示包含href链接的数据
我想要使用:nth-of-type在链接上它工作正常
Hi,
I display data in result div that contains a href links
I want to use :nth-of-type on the links it works fine
#result a:nth-of-type(even) {
background-color:#edeaea;
}
但是现在它只显示背景颜色作为文本大小
但我想将backgroundcolor显示为完整的结果表
所以我尝试使用
But right now it display the background-color only as the size of the text
But i want to display the backgroundcolor as full with of the result table
so i have tried with using
display:block;
然后它将颜色显示为表格div宽度,但它也会在
之间创建空格。所以对于ex
Data1 = white
Data1 = #edeaea
这里不是显示白色的数据,即使这里没有数据
然后Data3 = white
然后Data4 = #edeaea
然后再来这里它的白色没有数据
It then displays the color as the table div width but it also create white spaces between
So for ex
Data1 = white
Data1 = #edeaea
Here is not data it display white color even if its no data here
Then Data3 = white
Then Data4 = #edeaea
And then again here its white here is no data
推荐答案
我认为你的目标是错误的元素。 br />
因为你在谈论一个表,你应该定位tr元素。
这样,表内容是什么并不重要。
没有空格。
I think you are targeting the wrong element.
Since you're talking about a table, you should target the "tr" elements.
This way, it doesn't matter what the table content is.
There will be no white space.
这篇关于使用:nth-of-type创建空偶数元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!