Blocks – Render based on Attributes using CSS File
-
Hi,
I would like to render the frontend of a custom block using a variety of style attributes that are defined in the block sidebar setting.
Can you please elaborate how to better handle attribures with many possible values like a color attribute for a specific div element inside the block. One option is to use inline css and just echo the dynamic color. But in that case, I will start to mix many css attributes using inline css and I perfer to use the block css/scss files for managing and loading styles.
What is the best practices working with many block style attributes? any option to avoid using inline css in the render.php file?
render.php
<div class="my-box" style="background-color: <?php echo $attributes["box_background_color"];?>">
</div>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.