Skip to content

Commit

Permalink
Merge pull request #189 from lkhrs/issue188
Browse files Browse the repository at this point in the history
Center align images in figure elements
  • Loading branch information
lkhrs committed Mar 23, 2024
2 parents 442f7ca + c542b47 commit 8978758
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
13 changes: 7 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -769,22 +769,23 @@ <h2>Images</h2>
</header>

<h3>Plain <code>&lt;img&gt;</code> element</h3>
<p><img src="https://placekitten.com/480/480" alt="Photo of a kitten"></p>
<p><img src="https://placehold.co/480x480/EEE/31343C" alt="Placeholder image"></p>
<h3><code>&lt;figure&gt;</code> element with <code>&lt;img&gt;</code> element</h3>
<figure><img src="https://placekitten.com/420/420" alt="Photo of a kitten"></figure>
<figure><img src="https://placehold.co/420x420/EEE/31343C" alt="Placeholder image"></figure>
<h3><code>&lt;figure&gt;</code> element with <code>&lt;img&gt;</code> and
<code>&lt;figcaption&gt;</code> elements
</h3>
<figure>
<img src="https://placekitten.com/420/420" alt="Photo of a kitten">
<img src="https://placehold.co/420x420/EEE/31343C" alt="Placeholder image">
<figcaption>Here is a caption for this image.</figcaption>
</figure>
<h3><code>&lt;figure&gt;</code> element with a <code>&lt;picture&gt;</code> element</h3>
<figure>
<picture>
<source srcset="https://placekitten.com/800/800" media="(min-width: 800px)">
<img src="https://placekitten.com/420/420" alt="Photo of a kitten" />
<source srcset="https://placehold.co/2000x2000/EEE/31343C" media="(min-width: 800px)">
<img src="https://placehold.co/420x420/EEE/31343C" alt="Placeholder image" />
</picture>
<figcaption>Here is a caption for this image.</figcaption>
</figure>

<footer>
Expand All @@ -795,7 +796,7 @@ <h3><code>&lt;figure&gt;</code> element with a <code>&lt;picture&gt;</code> elem
<header>
<h2>Background images</h2>
</header>
<figure style="background-image:url('https://placekitten.com/300/300'); width:300px; height: 300px;">
<figure style="background-image:url('https://placehold.co/300x300/EEE/31343C'); width:300px; height: 300px;">
</figure>
<footer>
<p><a href="#top">[Top]</a></p>
Expand Down
2 changes: 1 addition & 1 deletion simple-v1.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion simple.css
Original file line number Diff line number Diff line change
Expand Up @@ -564,11 +564,17 @@ figure {
overflow-x: auto;
}

figure > img,
figure > picture > img {
display: block;
margin-inline: auto;
}

figcaption {
text-align: center;
font-size: 0.9rem;
color: var(--text-light);
margin-bottom: 1rem;
margin-block: 1rem;
}

blockquote {
Expand Down
Loading

0 comments on commit 8978758

Please sign in to comment.