问题描述
我想创建一个响应式WordPress主题的儿童主题。父主题的CSS定义了一些媒体查询,如:
@media screen and(max-width:1000px){/ * a bunch现在让我们假设我希望断点位于900px而不是1000px。有什么方法可以在我的孩子主题的CSS轻松覆盖这个? JoshC 是绝对的正确。
可能你不明白这个想法 - 媒体查询是一种类似于css的规则。
让我们说:你在主题中有媒体查询
@media screen and(max-width:1000px){#main {color:#000;}}
您将 ID主要设置为div,文字颜色为 BLACK 浏览器宽度不会超过1000px - (max-width:1000px)
无论您使用此查询,它的工作方式都是一样的。 / p>
你需要指定的是内部的东西,例如使以下更重要的用途:
@media screen and(max-width:1000px){#main {color:#000!important;}}
I want to create a child-theme of a responsive wordpress-theme. The parent theme's css defines somes media queries like:
@media screen and (max-width: 1000px) { /* a bunch of changes */ }
Now let's say I would like the breakpoint to be at 900px instead of 1000px. Is there any way to easily override this in my child-theme's css?
解决方案 JoshC is absolutely correct.
Probably you do not understand the idea - media query is nost some kind of rule like in css. This is more glogal understanding.
Let's say:
you have media query in main theme
@media screen and (max-width: 1000px) { #main{color:#000;} }
You set div with ID main to have text color BLACK but only if maximum browser width is not more then 1000px - (max-width: 1000px)
Wherever you use this query - it will work same way.
What you need to specify is the stuff inside, for example to make the following more important use:
@media screen and (max-width: 1000px) { #main{color:#000 !important;} }
这篇关于在wordpress child-theme中覆盖父css的媒体查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!