How do I make sure the gutenberg block CSS is not disrupted by generic styles?

I am working with a pre-existing theme. On the site in question, the style sets rules for P tags. These rules are applie

I am working with a pre-existing theme. On the site in question, the style sets rules for P tags. These rules are applied in preference to the class styles for P tags used in certain blocks. (With the result that covers, for example, look quite silly). How can I fix this?

I am working with a pre-existing theme. On the site in question, the style sets rules for P tags. These rules are applied in preference to the class styles for P tags used in certain blocks. (With the result that covers, for example, look quite silly). How can I fix this?

Share Improve this question asked Jul 6, 2019 at 19:13 Matthew Brown aka Lord MattMatthew Brown aka Lord Matt 1,0683 gold badges13 silver badges34 bronze badges 4
  • What do you mean covers? can you share your URL so we can see what is "silly" and what should you do. – Castiblanco Commented Jul 7, 2019 at 2:00
  • Covers are a built-in block type. By silly, I mean that style.css defines p as something like 12pt which makes .has_huge_font_size overridden. – Matthew Brown aka Lord Matt Commented Jul 7, 2019 at 6:59
  • 1 There's nothing special about Gutenberg here, your CSS just needs to use Specificity appropriately. – Jacob Peattie Commented Jul 11, 2019 at 12:29
  • Is there some way I can restate the block CSS, queue it last, or make it all !important? The theme is nice but it does not play well with the new block approached. – Matthew Brown aka Lord Matt Commented Aug 4, 2019 at 1:17
Add a comment  | 

1 Answer 1

Reset to default 1

Many of the default blocks add a class wp-block-[name] to the block's root element on save. You could use these to increase your class specificity.

For your example of covers, .wp-block-cover .has-huge-font-size or .wp-block-cover p.has-huge-font-size depending on how much specificity you need.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745334894a4623057.html

相关推荐

  • How do I make sure the gutenberg block CSS is not disrupted by generic styles?

    I am working with a pre-existing theme. On the site in question, the style sets rules for P tags. These rules are applie

    5小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信