Title: Styling blocks using theme.json
Last modified: January 27, 2022

---

# Styling blocks using theme.json

 *  [leemon](https://wordpress.org/support/users/leemon/)
 * (@leemon)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/styling-blocks-using-theme-json/)
 * I have an hybrid theme and I want to style blocks using the `theme.json` file
   instead of pure CSS. These are my code block CSS styles:
 *     ```
       .wp-block-code {
           background-color: transparent;
           font-family: Menlo, Consolas, Monaco, monospace;
           font-size: 0.8125rem;
           line-height: 1.5;
           margin-bottom: 1.6em;
           max-width: 100%;
           overflow: auto;
           padding: 1.6em;
       }
       ```
   
 * I know how to migrate the `background-color`, `font-family`, `font-size`, `line-
   height`, `margin-bottom` and `padding` CSS properties to `theme.json` properties,
   but what about `max-width` and `overflow`? Should these be kept in the CSS file?
 * Thanks in advance
    -  This topic was modified 4 years, 4 months ago by [leemon](https://wordpress.org/support/users/leemon/).
    -  This topic was modified 4 years, 4 months ago by [leemon](https://wordpress.org/support/users/leemon/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [leemon](https://wordpress.org/support/users/leemon/)
 * (@leemon)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/styling-blocks-using-theme-json/#post-15299246)
 * You linked to this same forum post
 *  [Smit Rathod](https://wordpress.org/support/users/smit08/)
 * (@smit08)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/styling-blocks-using-theme-json/#post-15300695)
 * Hi [@leemon](https://wordpress.org/support/users/leemon/)
 * For using max-width in theme.json, you can add below code.
 *     ```
       "layout": {
       		"contentSize": "100%"
       	}
       ```
   
 * So thats how you can add max-width and for overflow i think you should keep it
   in css.
 * Thank you.
    -  This reply was modified 4 years, 4 months ago by [Smit Rathod](https://wordpress.org/support/users/smit08/).
    -  This reply was modified 4 years, 4 months ago by [Smit Rathod](https://wordpress.org/support/users/smit08/).
 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/styling-blocks-using-theme-json/#post-15303173)
 * Sorry, here is the link to the 5.9 field Guide, which discusses many topics including
   theme.json
 * > [WordPress 5.9 Field Guide](https://make.wordpress.org/core/2022/01/10/wordpress-5-9-field-guide/)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Styling blocks using theme.json’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [t-p](https://wordpress.org/support/users/t-p/)
 * Last activity: [4 years, 4 months ago](https://wordpress.org/support/topic/styling-blocks-using-theme-json/#post-15303173)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
