Title: Blocks &#8211; Render based on Attributes using CSS File
Last modified: June 20, 2024

---

# Blocks – Render based on Attributes using CSS File

 *  Resolved [IncredibleWP](https://wordpress.org/support/users/incrediblewp/)
 * (@incrediblewp)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/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?
 *     ```wp-block-code
       render.php <div class="my-box" style="background-color: <?php echo $attributes["box_background_color"];?>"></div>
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [IncredibleWP](https://wordpress.org/support/users/incrediblewp/)
 * (@incrediblewp)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/blocks-render-based-on-attributes-using-css-file/#post-17841841)
 * I found the answers in the following link –
 * [https://developer.wordpress.org/news/2023/08/08/styling-blocks-empowering-users-with-css-custom-properties/](https://developer.wordpress.org/news/2023/08/08/styling-blocks-empowering-users-with-css-custom-properties/)

Viewing 1 replies (of 1 total)

The topic ‘Blocks – Render based on Attributes using CSS File’ is closed to new 
replies.

## Tags

 * [blocks](https://wordpress.org/support/topic-tag/blocks/)
 * [render](https://wordpress.org/support/topic-tag/render/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 1 participant
 * Last reply from: [IncredibleWP](https://wordpress.org/support/users/incrediblewp/)
 * Last activity: [1 year, 11 months ago](https://wordpress.org/support/topic/blocks-render-based-on-attributes-using-css-file/#post-17841841)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
