Figures
The theme has support for the <figure>
element. For example you can put an
image inside a figure like this:
<figure>
<img src="/jekyll-theme-oatcake/assets/images/grass.jpg" alt="A photo of some grass">
</figure>
To include a caption with your figure use the <figcaption>
tag:
<figure>
<img src="/jekyll-theme-oatcake/assets/images/grass.jpg" alt="A photo of some grass">
<figcaption>A photo of some grass</figcaption>
</figure>
That’ll produce this output:
Code Figures
Figures aren’t just for images. You can put anything in a figure. For example here’s a code figure:
Multi-Line Figure Captions
Here’s what a multi-line figure caption looks like:
When to Use Figures
According to the HTML spec on <figure>
a figure is supposed to be “self-contained” content (such as an image, code
snippet, table, video, or something) that is:
referred to from the main content of the document, but that could, without affecting the flow of the document, be moved away from that primary content, e.g. to the side of the page, to dedicated pages, or to an appendix.
If the particular location of an image or other content within the document is
important to the flow of the document then you should just use a standard
<img>
, <pre><code>
, or other content instead of a figure.