css - 你见过这样的CSS选择器吗?

标签 css css-selectors

table td+td+td+td+td+td{
    display:table-cell;
}

+是什么意思?

最佳答案

这是adjacent sibling selector .

所以如果你有某事。像:

<table> 
    <tr>
        <td></td> <!-- starting from here A-->
        <td></td> <!-- starting from here B-->
        <td></td>
        <td></td>
        <td></td>
        <td></td> <!-- selects this one A -->
        <td></td> <!-- selects this one B -->
    </tr>
</table>

因此,本例中的最后两个单元格将被选中。参见这里:http://jsfiddle.net/ERkEk/

整个CSS选择器似乎对我来说不是很有用(个人观点)就像对我来说硬编码一样。在某些情况下可能是必要的,但它比使用类更难维护。在这种情况下,您非常依赖标记。

更新: It is supported in all browsers but IE 5.5 and IE 6 and is not 100% supported in IE <= 8.

关于css - 你见过这样的CSS选择器吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3828432/

相关文章:

node.js - puppeteer 中的 page.$eval 函数始终返回未定义

css - Nth Child Last child 其中奇数

css - gwt 样式第 n 个子级与第一个子级碰撞

css - 如何让max-height在IE6,IE7中正常工作?

javascript - 使用 HREF 滚动按钮或修改 <a> 按钮链接的解决方案

jquery - 如何用省略号 "..."替换第一个溢出的元素

html - 如何获得填充或边距样式以在不同浏览器中选择选项

css - 在 React Native 中将图像置于 View 之上

html - 如何在 span 标签中做 CSS nth-child?

css - #id#id : Repeated occurrences of the same simple selector should increase specificity but don't for IDs in IE9