Tag: css selectors

什么是这个CSSselect器?

我在Twitter Bootstrap中看到了这个select器: .show-grid [class*="span"] { background-color: #eee; text-align: center; border-radius: 3px; min-height: 30px; line-height: 30px; } 有谁知道这种技术被称为什么?

如何在CSSselect器中结合类和ID?

如果我有以下div: <div class="sectionA" id="content"> Lorem Ipsum… </div> 有没有一种方法来定义一种风格,expression的想法“一个id='content'与id='content' AND class='myClass' ”? 或者你只是单方面或另一方面 <div class="content-sectionA"> Lorem Ipsum… </div> 要么 <div id="content-sectionA"> Lorem Ipsum… </div>

将CSS样式应用于子元素

我只想用一个特定的类将样式应用于DIV中的表格: 注意:我宁愿使用一个CSS的select器的儿童元素。 为什么#1的作品和#2没有? 1: div.test th, div.test td, div.test caption {padding:40px 100px 40px 50px;} 2: div.test th, td, caption {padding:40px 100px 40px 50px;} HTML: <html> <head> <style> div.test > th, td, caption {padding:40px 100px 40px 50px;} </style> </head> <body> <div> <table border="2"> <tr><td>some</td></tr> <tr><td>data</td></tr> <tr><td>here</td></tr> </table> </div> <div class="test"> <table border="2"> <tr><td>some</td></tr> <tr><td>data</td></tr> <tr><td>here</td></tr> </table> […]

CSS规则只适用于元素有两个类

比方说,我们有这个标记: <div class="abc"> … </div> <div class="xyz"> … </div> <div class="abc xyz" style="width: 100px"> … </div> 有没有办法只select具有abc和xyz类(最后一个)的<div>并覆盖其内联宽度使有效宽度为200px? 像这样的东西: [selector] { width: 200px !important; }

有什么区别:重点和:主动?

:focus和:active伪类有什么区别?

cssselect器匹配没有属性x的元素

我正在处理一个CSS文件,并find需要样式文本input框,但是,我遇到了问题。 我需要一个简单的声明来匹配所有这些元素: <input /> <input type='text' /> <input type='password' /> …但不匹配这些: <input type='submit' /> <input type='button' /> <input type='image' /> <input type='file' /> <input type='checkbox' /> <input type='radio' /> <input type='reset' /> 这是我想要做的: input[!type], input[type='text'], input[type='password'] { /* styles here */ } 在上面的CSS中,注意第一个select器是input[!type] 。 我的意思是我想select所有没有指定type属性的input框(因为它默认为文本,但是input[type='text']不匹配它)。 不幸的是,我能find的CSS3规范中没有这样的select器。 有谁知道一个办法来完成这个?

select除CSS中第一个“tr”之外的所有“tr”元素

我怎样才能select所有的tr元素,除了CSS中的表第一个tr ? 我尝试使用这种方法,但发现它不工作: http://www.daniel-lemire.com/blog/archives/2008/08/22/how-to-select-even-or-odd-rows-in-a-table-using-css-3/

CSS:不是(:最后一个孩子):在select器之后

我有一个元素列表: <ul> <li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> <li>Five</li> </ul> 和这样的风格: ul { list-style-type: none; text-align: center; } li { display: inline; } li:not(:last-child):after { content:' |'; } 输出One | Two | Three | Four | Five | One | Two | Three | Four | Five | 而不是One | Two | Three | Four | Five […]

*和* | *在CSS中有什么区别?

在CSS中, *将匹配任何元素。 通常,使用*|*而不是*来匹配所有元素。 这通常用于testing目的。 *和*|*在CSS中有什么区别?

Sass嵌套:hover不起作用

我已经写了这个代码,但是不起作用。 我的问题是什么? .class { margin:20px; :hover { color:yellow; } }