How to apply negative margin to blocks?

[ad_1]

I’m new to WordPress and site building in general. I heard that 6.6 is going to release in a couple weeks and bring negative margin support to the Gutenberg block editor but, man, I can’t wait for that really, I need to finish this website as soon as possible.

I’ve researched online that you can currently make negative margins through plugins, but I’m trying to use as little plugins as possible to reduce my dependency and cut off the bloat. I heard you can use negative margins with theme.json but there are no direct explanations on how. I also heard that you can make a CSS class and use that on an individual block, but I did that and it isn’t affecting my block.

I gave this one group block the class, “custommargin1”, and then made an additional CSS in the Styles section,

`custommargin1 {`
`margin-top: -7.17em;`
`}`

However this doesn’t work. Can anyone help me out?

[ad_2]
3 Comments
  1. If that’s exactly how your code looks then you are missing the “.” Before the class name

    .custommargin1 {
    margin-top: -7.17em;
    }

  2. Install the WordPress Beta Tester plug-in and upgrade your WP to the 6.6 release candidate version, it is pretty much the same version they will launch this month. The you can use the UI to apply the negative margins right now.

  3. What are you trying to do exactly? There’s rarely a good reason to use negative margins. Can you share the URL of the page?

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer