figure.m-figure > * {
margin-left: 1rem;
margin-right: 1rem;
+ display: table-caption;
+ caption-side: bottom;
}
-figure.m-figure:after {
- content: ' ';
- display: block;
- margin-top: 1rem;
- height: 1px;
+figure.m-figure > *:first-child {
+ /* otherwise figure with clickable image is center differently */
+ display: inline;
+}
+figure.m-figure > *:last-child {
+ margin-bottom: 1rem;
}
figure.m-figure img {
position: relative; /* so it's above the border */
margin-bottom: 0;
border-top-left-radius: 0.2rem;
border-top-right-radius: 0.2rem;
+ max-width: 100%;
}
figure.m-figure figcaption {
margin-top: 0.5rem;
margin-left: -1rem;
margin-right: -1rem;
}
-figure.m-figure.m-fullwidth {
+figure.m-figure.m-fullwidth, figure.m-figure.m-fullwidth > * {
+ /* Using inline for the content would lose the margin on wrapped lines */
display: block;
}
+figure.m-figure.m-fullwidth > *:first-child {
+ display: inline;
+}
figure.m-figure.m-fullwidth img {
width: 100%;
}
+figure.m-figure.m-fullwidth:after {
+ /* Specifying bottom margin on the last element works only if it is displayed
+ as table caption, so I have to hack it here. */
+ content: ' ';
+ display: block;
+ margin-top: 1rem;
+ height: 1px;
+}
/* Code figure */
figure.m-code-figure {
figure.m-figure > * {
margin-left: 1rem;
margin-right: 1rem;
+ display: table-caption;
+ caption-side: bottom;
}
-figure.m-figure:after {
- content: ' ';
- display: block;
- margin-top: 1rem;
- height: 1px;
+figure.m-figure > *:first-child {
+ display: inline;
+}
+figure.m-figure > *:last-child {
+ margin-bottom: 1rem;
}
figure.m-figure img {
position: relative; /* so it's above the border */
margin-bottom: 0;
border-top-left-radius: 0.2rem;
border-top-right-radius: 0.2rem;
+ max-width: 100%;
}
figure.m-figure figcaption {
margin-top: 0.5rem;
margin-left: -1rem;
margin-right: -1rem;
}
-figure.m-figure.m-fullwidth {
+figure.m-figure.m-fullwidth, figure.m-figure.m-fullwidth > * {
display: block;
}
+figure.m-figure.m-fullwidth > *:first-child {
+ display: inline;
+}
figure.m-figure.m-fullwidth img {
width: 100%;
}
+figure.m-figure.m-fullwidth:after {
+ content: ' ';
+ display: block;
+ margin-top: 1rem;
+ height: 1px;
+}
figure.m-code-figure {
margin-top: 0;
margin-left: 0;
figure.m-figure > * {
margin-left: 1rem;
margin-right: 1rem;
+ display: table-caption;
+ caption-side: bottom;
}
-figure.m-figure:after {
- content: ' ';
- display: block;
- margin-top: 1rem;
- height: 1px;
+figure.m-figure > *:first-child {
+ display: inline;
+}
+figure.m-figure > *:last-child {
+ margin-bottom: 1rem;
}
figure.m-figure img {
position: relative; /* so it's above the border */
margin-bottom: 0;
border-top-left-radius: 0.2rem;
border-top-right-radius: 0.2rem;
+ max-width: 100%;
}
figure.m-figure figcaption {
margin-top: 0.5rem;
margin-left: -1rem;
margin-right: -1rem;
}
-figure.m-figure.m-fullwidth {
+figure.m-figure.m-fullwidth, figure.m-figure.m-fullwidth > * {
display: block;
}
+figure.m-figure.m-fullwidth > *:first-child {
+ display: inline;
+}
figure.m-figure.m-fullwidth img {
width: 100%;
}
+figure.m-figure.m-fullwidth:after {
+ content: ' ';
+ display: block;
+ margin-top: 1rem;
+ height: 1px;
+}
figure.m-code-figure {
margin-top: 0;
margin-left: 0;
<figure class="m-figure">
<img src="{filename}/static/ship-small.jpg" />
<figcaption>A Ship</figcaption>
- <div>Photo © <a href="http://blog.mosra.cz/">The Author</a></div>
+ <span>Photo © <a href="http://blog.mosra.cz/">The Author</a></span>
</figure>
Figure, centered, image link, flat:
<figure class="m-figure m-flat">
<a href="http://blog.mosra.cz/"><img src="{filename}/static/ship-small.jpg" /></a>
<figcaption>A Ship</figcaption>
- <div>Photo © <a href="http://blog.mosra.cz/">The Author</a></div>
+ <span>Photo © <a href="http://blog.mosra.cz/">The Author</a></span>
</figure>
Figure, fullwidth, without description (yes, it should be pixelated):
<figcaption>A Ship</figcaption>
</figure>
+Figure, fullwidth, with a long caption and description, there should be no
+unnecessary wrapping of the text:
+
+.. raw:: html
+
+ <figure class="m-figure m-fullwidth">
+ <img src="{filename}/static/ship-small.jpg" />
+ <figcaption>A Somewhat Lengthy Caption For A Photo</figcaption>
+ <span>The Photo Displayed Above Was Kindly Taken And Allowed To Be Used
+ On This Page By <a href="http://blog.mosra.cz/">The Author</a>. All
+ Rights Reserved.</span>
+ </figure>
+
+Figure with a large image but not fullwidth, should look the same as above, no
+leaking of the image outside of the page:
+
+.. raw:: html
+
+ <figure class="m-figure">
+ <img src="{filename}/static/ship.jpg" />
+ <figcaption>A Somewhat Lengthy Caption For A Photo</figcaption>
+ <span>The Photo Displayed Above Was Kindly Taken And Allowed To Be Used
+ On This Page By <a href="http://blog.mosra.cz/">The Author</a>. All
+ Rights Reserved.</span>
+ </figure>
+
+Figure with a long caption and description, then just a caption (it should wrap
+instead of extending the border and there should be proper padding on bottom):
+
+.. raw:: html
+
+ <figure class="m-figure">
+ <img src="{filename}/static/ship-small.jpg" />
+ <figcaption>A Somewhat Lengthy Caption For A Photo</figcaption>
+ <span>The Photo Displayed Above Was Kindly Taken And Allowed To Be Used
+ On This Page By <a href="http://blog.mosra.cz/">The Author</a>. All
+ Rights Reserved.</span>
+ </figure>
+
+.. raw:: html
+
+ <figure class="m-figure">
+ <img src="{filename}/static/ship-small.jpg" />
+ <figcaption>A Somewhat Lengthy Caption For A Photo</figcaption>
+ </figure>
+
Image grid
==========