How to set block diagram padding in Mermaid
Step-by-step guideby SceneRecap AI
Before you start
•Open the Mermaid Live Editor in a web browser.
•Have a block-beta diagram in the Code tab, such as: block-beta, A["A"] B["B"] C["C"] D["D"].
- 1
Open the editor and wait for the page to load. The Code tab is active.
· Code tab - 2
Review the block-beta code in the Code tab. The preview shows four square blocks labeled A, B, C and D in a row.
· Code editor panel - 3
Add a new first line above block-beta that reads %%{init: {'block': {'padding': 20}}}%%.
· Code editor, line 1 - 4
Check the preview. The blocks now render as shorter rectangles with smaller labels and wider gaps between them.
· Diagram preview area
End state
At 13.0s the code starts with %%{init: {'block': {'padding': 20}}}%% followed by the block-beta definition. The preview shows blocks A, B, C and D with the new padding applied.
These steps were written by SceneRecap from a screen recording. Make your own guide free
Make a step-by-step guide like this from a screen recording.
Do the task once while recording. SceneRecap writes the steps, each linked to its moment in the video. Guides are on every plan, Free included.
Make your own guide free →