html - 树形结构父元素
问题描述
我有一段代码可以使菜单中的元素 1 和 2 在悬停时使用 CSS 变得丰富多彩。0. 元素“VCM Panopto”(父)的 HTML 代码是什么?如果我写 child:0 它不起作用
div.o_tree.o_tree_root_visible.o_course_menu ul.o_tree_l0 li.active_parent ul.o_tree_l1 li:nth-Child(1) span.o_tree_link.o_tree_l1.o_tree_level_label_leaf.active,
div.o_tree.o_tree_root_visible.o_course_menu ul.o_tree_l0 li.active_parent ul.o_tree_l1 li:nth-Child(1) span.o_tree_link.o_tree_l1.o_tree_level_label_leaf.focus,
div.o_tree.o_tree_root_visible.o_course_menu ul.o_tree_l0 li.active_parent ul.o_tree_l1 li:nth-Child(1) span.o_tree_link.o_tree_l1.o_tree_level_label_leaf:hover,
div.o_tree.o_tree_root_visible.o_course_menu ul.o_tree_l0 li.active_parent ul.o_tree_l1 li:nth-Child(1) span.o_tree_link.o_tree_l1.o_tree_level_label_leaf a:hover
{
background-color: #2f7ca6; /* BLUE */
/*color: #fff;*/
}
div.o_tree.o_tree_root_visible.o_course_menu ul.o_tree_l0 li.active_parent ul.o_tree_l1 li:nth-Child(2) span.o_tree_link.o_tree_l1.o_tree_level_label_leaf.active,
div.o_tree.o_tree_root_visible.o_course_menu ul.o_tree_l0 li.active_parent ul.o_tree_l1 li:nth-Child(2) span.o_tree_link.o_tree_l1.o_tree_level_label_leaf.focus,
div.o_tree.o_tree_root_visible.o_course_menu ul.o_tree_l0 li.active_parent ul.o_tree_l1 li:nth-Child(2) span.o_tree_link.o_tree_l1.o_tree_level_label_leaf:hover,
div.o_tree.o_tree_root_visible.o_course_menu ul.o_tree_l0 li.active_parent ul.o_tree_l1 li:nth-Child(2) span.o_tree_link.o_tree_l1.o_tree_level_label_leaf a:hover
{
background-color: #b10058; /* FUCHSIA */
/*color: #fff;*/
}
解决方案
此代码有效
#dd102071742529541 > .o_tree_link:hover {
background-color: green !important;
}