如何选择所有< tr>他们的id以section_开头并以_dummy结尾的元素?
例如.我想选择以下< tr> s:
- <tr id="section_5_1_dummy">
- <td>...</td>
- </tr>
- <tr id="section_5_2_dummy">
- <td>...</td>
- </tr>
解决方法
以下CSS3选择器将执行以下任务:
- tr[id^="section_"][id$="_dummy"] {
- height: 200px;
- }
^表示id应该以什么开头.
$表示id应该以什么结尾.
id本身可以替换为另一个属性,如href,当应用于(例如)< a>:
- a[href^="http://www.example.com/product_"][href$="/about"] {
- background-color: red;
- }