在IE8获得最后一个div的div? [英] Getting last-child of a div in IE8?
本文介绍了在IE8获得最后一个div的div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有另外一种方法可以获得div元素的最后一个子元素,而不是使用 div:last-child
,这在IE8中不起作用?
解决方案
在jQuery中很容易:
$(div:last-child)
此外,还要注意区别:
-
div:last-child
:div的每个最后一个子和 -
div:last-child
:每个div
Is there another way to get the last child of a div element other than using div:last-child
, which does not work in IE8 at least?
解决方案
In jQuery it's easy:
$("div :last-child")
In pure CSS it can't be done.
Otherwise you're stuck with traversing the DOM in Javascript.
Also note the difference:
"div :last-child"
: every last child of a div; and"div:last-child"
: every div that is a last child.
这篇关于在IE8获得最后一个div的div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文