chiark / gitweb /
css: support .m-image and .m-figure for <video> as well.
authorVladimír Vondruš <mosra@centrum.cz>
Fri, 3 Nov 2023 12:50:40 +0000 (13:50 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Fri, 3 Nov 2023 12:50:40 +0000 (13:50 +0100)
css/m-components.css
css/m-dark+documentation.compiled.css
css/m-dark.compiled.css
css/m-light+documentation.compiled.css
css/m-light.compiled.css
doc/css/components.rst

index e90e1cd9202329f6eeab51dfe01d18d06a932720..7aac3c55f747ea4396933f322259b171507b42ab 100644 (file)
@@ -489,8 +489,8 @@ table.m-table th.m-dim pre, table.m-table th.m-dim code {
   background-color: var(--code-note-background-color);
 }
 
-/* Image. Ensure everything is done for both <img> and <svg>. */
-img.m-image, svg.m-image {
+/* Image. Ensure everything is done for <img>, <svg> and <video> as well. */
+img.m-image, svg.m-image, video.m-image {
   display: block;
   margin-left: auto;
   margin-right: auto;
@@ -498,20 +498,23 @@ img.m-image, svg.m-image {
 div.m-image {
   text-align: center;
 }
-img.m-image, svg.m-image, div.m-image img, div.m-image svg {
+img.m-image, svg.m-image, video.m-image,
+div.m-image img, div.m-image svg, div.m-image video {
   max-width: 100%;
   border-radius: var(--border-radius);
 }
-div.m-image.m-fullwidth img, div.m-image.m-fullwidth svg {
+div.m-image.m-fullwidth img,
+div.m-image.m-fullwidth svg,
+div.m-image.m-fullwidth video {
   width: 100%;
 }
 /* Image badge. Deliberately omitting <svg> since I don't see any use for those
-   as avatars yet. */
+   as avatars yet, <video> as well. */
 img.m-image.m-badge, div.m-image.m-badge img {
   border-radius: 50%;
 }
 
-/* Figure. Ensure everything is done for both <img> and <svg>. */
+/* Figure. Ensure everything is done for <img>, <svg> and <video> as well. */
 figure.m-figure {
   max-width: 100%;
   margin-top: 0;
@@ -553,7 +556,9 @@ figure.m-figure > *:last-child {
      priority than this */
   margin-bottom: 1rem !important;
 }
-figure.m-figure img, figure.m-figure svg {
+figure.m-figure img,
+figure.m-figure svg,
+figure.m-figure video {
   position: relative; /* so it's above the border */
   margin-left: 0;
   margin-right: 0;
@@ -562,11 +567,15 @@ figure.m-figure img, figure.m-figure svg {
   border-top-right-radius: var(--border-radius);
   max-width: 100%;
 }
-figure.m-figure.m-flat img, figure.m-figure.m-flat svg {
+figure.m-figure.m-flat img,
+figure.m-figure.m-flat svg,
+figure.m-figure.m-flat video {
   border-bottom-left-radius: var(--border-radius);
   border-bottom-right-radius: var(--border-radius);
 }
-figure.m-figure a img, figure.m-figure a svg {
+figure.m-figure a img,
+figure.m-figure a svg,
+figure.m-figure a video {
   margin-left: -1rem;
   margin-right: -1rem;
 }
@@ -578,7 +587,9 @@ figure.m-figure.m-fullwidth > *:first-child {
   /* otherwise figure with clickable image is centered differently */
   display: inline;
 }
-figure.m-figure.m-fullwidth img, figure.m-figure.m-fullwidth svg {
+figure.m-figure.m-fullwidth img,
+figure.m-figure.m-fullwidth svg,
+figure.m-figure.m-fullwidth video {
   width: 100%;
 }
 figure.m-figure.m-fullwidth::after {
index 7d091c2fad4e914838c0068b88c095f9fe6bee32..cda89e737231b4d2091e47bfc4c3455d865e64ac 100644 (file)
@@ -766,7 +766,7 @@ table.m-table td.m-dim pre, table.m-table td.m-dim code,
 table.m-table th.m-dim pre, table.m-table th.m-dim code {
   background-color: rgba(34, 39, 46, 0.5);
 }
-img.m-image, svg.m-image {
+img.m-image, svg.m-image, video.m-image {
   display: block;
   margin-left: auto;
   margin-right: auto;
@@ -774,11 +774,14 @@ img.m-image, svg.m-image {
 div.m-image {
   text-align: center;
 }
-img.m-image, svg.m-image, div.m-image img, div.m-image svg {
+img.m-image, svg.m-image, video.m-image,
+div.m-image img, div.m-image svg, div.m-image video {
   max-width: 100%;
   border-radius: 0.2rem;
 }
-div.m-image.m-fullwidth img, div.m-image.m-fullwidth svg {
+div.m-image.m-fullwidth img,
+div.m-image.m-fullwidth svg,
+div.m-image.m-fullwidth video {
   width: 100%;
 }
 img.m-image.m-badge, div.m-image.m-badge img {
@@ -820,7 +823,9 @@ figure.m-figure > *:first-child {
 figure.m-figure > *:last-child {
   margin-bottom: 1rem !important;
 }
-figure.m-figure img, figure.m-figure svg {
+figure.m-figure img,
+figure.m-figure svg,
+figure.m-figure video {
   position: relative;
   margin-left: 0;
   margin-right: 0;
@@ -829,11 +834,15 @@ figure.m-figure img, figure.m-figure svg {
   border-top-right-radius: 0.2rem;
   max-width: 100%;
 }
-figure.m-figure.m-flat img, figure.m-figure.m-flat svg {
+figure.m-figure.m-flat img,
+figure.m-figure.m-flat svg,
+figure.m-figure.m-flat video {
   border-bottom-left-radius: 0.2rem;
   border-bottom-right-radius: 0.2rem;
 }
-figure.m-figure a img, figure.m-figure a svg {
+figure.m-figure a img,
+figure.m-figure a svg,
+figure.m-figure a video {
   margin-left: -1rem;
   margin-right: -1rem;
 }
@@ -843,7 +852,9 @@ figure.m-figure.m-fullwidth, figure.m-figure.m-fullwidth > * {
 figure.m-figure.m-fullwidth > *:first-child {
   display: inline;
 }
-figure.m-figure.m-fullwidth img, figure.m-figure.m-fullwidth svg {
+figure.m-figure.m-fullwidth img,
+figure.m-figure.m-fullwidth svg,
+figure.m-figure.m-fullwidth video {
   width: 100%;
 }
 figure.m-figure.m-fullwidth::after {
index c59cf4090ed093fd527f561af59805085bdf689b..4243656651f1a6bf16d279efbcc8b0de8275920b 100644 (file)
@@ -766,7 +766,7 @@ table.m-table td.m-dim pre, table.m-table td.m-dim code,
 table.m-table th.m-dim pre, table.m-table th.m-dim code {
   background-color: rgba(34, 39, 46, 0.5);
 }
-img.m-image, svg.m-image {
+img.m-image, svg.m-image, video.m-image {
   display: block;
   margin-left: auto;
   margin-right: auto;
@@ -774,11 +774,14 @@ img.m-image, svg.m-image {
 div.m-image {
   text-align: center;
 }
-img.m-image, svg.m-image, div.m-image img, div.m-image svg {
+img.m-image, svg.m-image, video.m-image,
+div.m-image img, div.m-image svg, div.m-image video {
   max-width: 100%;
   border-radius: 0.2rem;
 }
-div.m-image.m-fullwidth img, div.m-image.m-fullwidth svg {
+div.m-image.m-fullwidth img,
+div.m-image.m-fullwidth svg,
+div.m-image.m-fullwidth video {
   width: 100%;
 }
 img.m-image.m-badge, div.m-image.m-badge img {
@@ -820,7 +823,9 @@ figure.m-figure > *:first-child {
 figure.m-figure > *:last-child {
   margin-bottom: 1rem !important;
 }
-figure.m-figure img, figure.m-figure svg {
+figure.m-figure img,
+figure.m-figure svg,
+figure.m-figure video {
   position: relative;
   margin-left: 0;
   margin-right: 0;
@@ -829,11 +834,15 @@ figure.m-figure img, figure.m-figure svg {
   border-top-right-radius: 0.2rem;
   max-width: 100%;
 }
-figure.m-figure.m-flat img, figure.m-figure.m-flat svg {
+figure.m-figure.m-flat img,
+figure.m-figure.m-flat svg,
+figure.m-figure.m-flat video {
   border-bottom-left-radius: 0.2rem;
   border-bottom-right-radius: 0.2rem;
 }
-figure.m-figure a img, figure.m-figure a svg {
+figure.m-figure a img,
+figure.m-figure a svg,
+figure.m-figure a video {
   margin-left: -1rem;
   margin-right: -1rem;
 }
@@ -843,7 +852,9 @@ figure.m-figure.m-fullwidth, figure.m-figure.m-fullwidth > * {
 figure.m-figure.m-fullwidth > *:first-child {
   display: inline;
 }
-figure.m-figure.m-fullwidth img, figure.m-figure.m-fullwidth svg {
+figure.m-figure.m-fullwidth img,
+figure.m-figure.m-fullwidth svg,
+figure.m-figure.m-fullwidth video {
   width: 100%;
 }
 figure.m-figure.m-fullwidth::after {
index e0759f222c78b7f6011a2013033e9e95ee91652d..88d6de9bec8e63acc9dc5d610a80840bfe19dd78 100644 (file)
@@ -766,7 +766,7 @@ table.m-table td.m-dim pre, table.m-table td.m-dim code,
 table.m-table th.m-dim pre, table.m-table th.m-dim code {
   background-color: rgba(251, 240, 236, 0.5);
 }
-img.m-image, svg.m-image {
+img.m-image, svg.m-image, video.m-image {
   display: block;
   margin-left: auto;
   margin-right: auto;
@@ -774,11 +774,14 @@ img.m-image, svg.m-image {
 div.m-image {
   text-align: center;
 }
-img.m-image, svg.m-image, div.m-image img, div.m-image svg {
+img.m-image, svg.m-image, video.m-image,
+div.m-image img, div.m-image svg, div.m-image video {
   max-width: 100%;
   border-radius: 0.2rem;
 }
-div.m-image.m-fullwidth img, div.m-image.m-fullwidth svg {
+div.m-image.m-fullwidth img,
+div.m-image.m-fullwidth svg,
+div.m-image.m-fullwidth video {
   width: 100%;
 }
 img.m-image.m-badge, div.m-image.m-badge img {
@@ -820,7 +823,9 @@ figure.m-figure > *:first-child {
 figure.m-figure > *:last-child {
   margin-bottom: 1rem !important;
 }
-figure.m-figure img, figure.m-figure svg {
+figure.m-figure img,
+figure.m-figure svg,
+figure.m-figure video {
   position: relative;
   margin-left: 0;
   margin-right: 0;
@@ -829,11 +834,15 @@ figure.m-figure img, figure.m-figure svg {
   border-top-right-radius: 0.2rem;
   max-width: 100%;
 }
-figure.m-figure.m-flat img, figure.m-figure.m-flat svg {
+figure.m-figure.m-flat img,
+figure.m-figure.m-flat svg,
+figure.m-figure.m-flat video {
   border-bottom-left-radius: 0.2rem;
   border-bottom-right-radius: 0.2rem;
 }
-figure.m-figure a img, figure.m-figure a svg {
+figure.m-figure a img,
+figure.m-figure a svg,
+figure.m-figure a video {
   margin-left: -1rem;
   margin-right: -1rem;
 }
@@ -843,7 +852,9 @@ figure.m-figure.m-fullwidth, figure.m-figure.m-fullwidth > * {
 figure.m-figure.m-fullwidth > *:first-child {
   display: inline;
 }
-figure.m-figure.m-fullwidth img, figure.m-figure.m-fullwidth svg {
+figure.m-figure.m-fullwidth img,
+figure.m-figure.m-fullwidth svg,
+figure.m-figure.m-fullwidth video {
   width: 100%;
 }
 figure.m-figure.m-fullwidth::after {
index 56cef576dc98601113c68f8c2aed09fe6efcb33b..0382f33b199865a955d62908a14425eeef84f5ac 100644 (file)
@@ -766,7 +766,7 @@ table.m-table td.m-dim pre, table.m-table td.m-dim code,
 table.m-table th.m-dim pre, table.m-table th.m-dim code {
   background-color: rgba(251, 240, 236, 0.5);
 }
-img.m-image, svg.m-image {
+img.m-image, svg.m-image, video.m-image {
   display: block;
   margin-left: auto;
   margin-right: auto;
@@ -774,11 +774,14 @@ img.m-image, svg.m-image {
 div.m-image {
   text-align: center;
 }
-img.m-image, svg.m-image, div.m-image img, div.m-image svg {
+img.m-image, svg.m-image, video.m-image,
+div.m-image img, div.m-image svg, div.m-image video {
   max-width: 100%;
   border-radius: 0.2rem;
 }
-div.m-image.m-fullwidth img, div.m-image.m-fullwidth svg {
+div.m-image.m-fullwidth img,
+div.m-image.m-fullwidth svg,
+div.m-image.m-fullwidth video {
   width: 100%;
 }
 img.m-image.m-badge, div.m-image.m-badge img {
@@ -820,7 +823,9 @@ figure.m-figure > *:first-child {
 figure.m-figure > *:last-child {
   margin-bottom: 1rem !important;
 }
-figure.m-figure img, figure.m-figure svg {
+figure.m-figure img,
+figure.m-figure svg,
+figure.m-figure video {
   position: relative;
   margin-left: 0;
   margin-right: 0;
@@ -829,11 +834,15 @@ figure.m-figure img, figure.m-figure svg {
   border-top-right-radius: 0.2rem;
   max-width: 100%;
 }
-figure.m-figure.m-flat img, figure.m-figure.m-flat svg {
+figure.m-figure.m-flat img,
+figure.m-figure.m-flat svg,
+figure.m-figure.m-flat video {
   border-bottom-left-radius: 0.2rem;
   border-bottom-right-radius: 0.2rem;
 }
-figure.m-figure a img, figure.m-figure a svg {
+figure.m-figure a img,
+figure.m-figure a svg,
+figure.m-figure a video {
   margin-left: -1rem;
   margin-right: -1rem;
 }
@@ -843,7 +852,9 @@ figure.m-figure.m-fullwidth, figure.m-figure.m-fullwidth > * {
 figure.m-figure.m-fullwidth > *:first-child {
   display: inline;
 }
-figure.m-figure.m-fullwidth img, figure.m-figure.m-fullwidth svg {
+figure.m-figure.m-fullwidth img,
+figure.m-figure.m-fullwidth svg,
+figure.m-figure.m-fullwidth video {
   width: 100%;
 }
 figure.m-figure.m-fullwidth::after {
index 785f3eee696a487d4069690251f2b1567533433e..439974e7c863b881837365cff6038b8aba65cf1b 100644 (file)
@@ -607,10 +607,11 @@ justified.
 `Images`_
 =========
 
-Putting :css:`.m-image` class onto an :html:`<img>` / :html:`<svg>` tag makes
-the image centered, slightly rounded and sets its max width to 100%. Adding
-:css:`.m-fullwidth` on the image element works as expected. For accessibility
-reasons it's a good practice to include the ``alt`` attribute.
+Putting :css:`.m-image` class onto an :html:`<img>`, :html:`<svg>` or
+:html:`<video>` tag makes the image or video centered, slightly rounded and
+sets its max width to 100%. Adding :css:`.m-fullwidth` on the image element
+works as expected. For accessibility reasons it's a good practice to include
+the ``alt`` attribute.
 
 .. code-figure::
 
@@ -650,6 +651,8 @@ not the surrounding area:
 For avatars, similarly to the `Badges`_ above, applying a :css:`.m-badge` class
 together with :css:`.m-image` will make the image round. Works for both plain
 :html:`<img>` and clickable images wrapped in :html:`<div class="m-image">`.
+The :css:`.m-badge` isn't recognized for :html:`<svg>` or :html:`<video>`
+however.
 
 .. code-figure::
 
@@ -670,8 +673,8 @@ border around the caption and description. The caption is expected to be in the
 :html:`<figcaption>` element. Inside it, there can optionally be a longer
 description wrapped in a :css:`div.m-figure-description` element. The
 :css:`.m-fullwidth` class works here too and you can also wrap the
-:html:`<img>` / :html:`<svg>` element in an :html:`<a>` tag to make it
-clickable.
+:html:`<img>` / :html:`<svg>` / :html:`<video>` element in an :html:`<a>` tag
+to make it clickable.
 
 Figure always expects at least the caption to be present. If you want just an
 image, use the plain image tag. If you have a lot of figures on the page and