我想要规则被覆盖

编程入门 行业动态 更新时间:2024-10-22 11:27:22
本文介绍了我想要规则被覆盖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的页面中有两个列表。第一个在 #main 元素中,第二个在 #footer 元素中。由于 #footer 元素在 #main 元素内,这些是我的规则:

I have two lists in my page. The first one in the #main element, and the second one in the #footer element. Since the #footer element is inside the #main element these are my rules:

body div#wrap_all div#main div#footer div.widget_nav_menu ul#menu-footer li { border-right: 1px solid #D2AB67; display: inline-block !important; padding: 0 10px; } /* I dont want this rules below to be applied to the list in the footer */ body div#wrap_all div#main section.avia_widget_section ul li { border-bottom: 1px solid #E0D3CD; font-family: "Georgia"; font-size: 17px; font-style: italic; padding: 7px 0 0 22px; /* O_o this rule is overwritten of course */ }

问题:规则的第一个列表也应用于 .footer 元素中的列表。我能做些什么来避免呢?

The problem: the rules of the first list are also applied to the list in the .footer element. What can I do to avoid that?

推荐答案

您可以使用:not()selector。

you can use the :not() selector.

body div#wrap_all div#main section.avia_widget_section :not(#footer) ul li { }

或重置特定规则:

body div#wrap_all div#main section.avia_widget_section #footer ul li { padding:0; /* or whatever */ }

更多推荐

我想要规则被覆盖

本文发布于:2023-11-08 07:42:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1568766.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:被覆   规则   我想要

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!