Way to show mutiple figures in columns and rows #555
-
Hello all, I am trying to write slides with Marp. Occasionally, I need to include multiple figures in columns and rows in one slide, which I think might be a common need. However, I am sorry I did not find the relevant information on the doc page or anywhere else. Could you please teach me how to arrange the figures flexibly? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
A common solution is using the table syntax for Markdown. Marp assumes familiarity with Markdown syntax, so sites such as Markdown guide can be useful references for Markdown syntaxes. | ![image1](https://picsum.photos/200?image=1) | ![image2](https://picsum.photos/200?image=10) |
| :---: | :---: |
| ![image3](https://picsum.photos/200?image=11) | ![image4](https://picsum.photos/200?image=12) | Or you can be achieved it by using style such as CSS Grid if you need to fine layout. This approach should also be compatible with non Marp Markdown document if the style was supported. <style>
.grid {
display: grid;
grid-template-columns: repeat(2, auto);
gap: 1rem;
place-items: center;
width: fit-content;
p, img {
display: block;
margin: 0;
}
}
</style>
# Grid layout
<div class="grid">
![image1](https://picsum.photos/200?image=1)
![image2](https://picsum.photos/200?image=10)
![image3](https://picsum.photos/200?image=11)
![image4](https://picsum.photos/200?image=12)
</div> You can reference how about CSS Grid in MDN. |
Beta Was this translation helpful? Give feedback.
A common solution is using the table syntax for Markdown. Marp assumes familiarity with Markdown syntax, so sites such as Markdown guide can be useful references for Markdown syntaxes.
Or you can be achieved it by using style such as CSS Grid if you need to fine layout. This approach should also be compatible with non Marp Markdown document if the style was supported.