如何突出最后一个html元素与特定的css类 [英] How to highlight last html-element with specific css class

查看:416
本文介绍了如何突出最后一个html元素与特定的css类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 class =block在以下html结构中突出显示最后一个div,如果 div class =block未知? (借助css选择器)

How to highlight last div with class="block" in the following html-structure, if the number of div with class="block" is unknown? (With help of css-selectors)

http: //codepen.io/Feel_codepen/pen/Ifjzd

例如,我可以突出显示第三个div。

There, for example, I can highlight third div.

推荐答案

您可以使用:最后类型

div.block:last-of-type{
 color:yellow;
}

CodepenDemo

这篇关于如何突出最后一个html元素与特定的css类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆