Best practices to add custom CSS code to Block Theme
-
Hi everybody, new here, sorry if I’m doing something wrong.
First thing, search functionality in www.remarpro.com seems to be broken to me so I couldn’t search if the topics has been solved already.
I’m creating my first Block Theme and I need to add some custom CSS to certain blocks. I’m struggling to understand the best way to do it. Inline CSS seems to me like creating a lot of noise in the component since I need to add several rules.
Here is the example I’m trying to figure out:
<!-- wp:columns --> <div class="wp-block-columns"> <!-- wp:video --> <figure class="wp-block-video"> </figure> <!-- /wp:video --> <!-- wp:column --> <div class="wp-block-column"> <!-- wp:heading {"level": 1, "align":"wide"} --> <h1 class="alignwide">Un taller digital para tus proyectos</h1> <!-- /wp:heading --> <!-- wp:heading {"level": 2, "align":"wide"} --> <h2 class="alignwide">Infraestructura digital Comunitaria</h2> <!-- /wp:heading --> <!-- wp:group {"layout":{"type":"flex","allowOrientation":false}} --> <div class="wp-block-group"> <!-- wp:paragraph --><p>?Tienes un proyecto digital y no sabes por dónde empezar?</p><!-- /wp:paragraph --> <!-- wp:buttons --> <div class="wp-block-buttons"> <!-- wp:button --> <div class="wp-block-button"><a class="wp-block-button__link">??</img> Cuéntanoslo</a></div> <!-- /wp:button --> </div> <!-- /wp:buttons --> </div> <!-- /wp:group --> </div> <!-- /wp:column --> <!-- wp:column --> <div class="wp-block-column"> </div> <!-- /wp:column --> </div> <!-- /wp:columns -->
What I want to do is add a video as background adding this CSS class to the generated video HTML element when adding the video file from the visual editor, in Settings/Advanced/CSS class:
.awt-bg-video { position: absolute; width: 100%; height: 100%; z-index: -1; object-fit: cover; object-position: center; }
?Any hint on how to manage this properly?
- The topic ‘Best practices to add custom CSS code to Block Theme’ is closed to new replies.