html - Special use cases for the figure element in HTML5 -
please let me know if understanding of figure element accurate.
to best of knowledge, figure element seems have 2 types of children, object in question (img, table, video, quotes, etc) , description of object. because single figcaption can exist within figure, , content describing must included inside. if want straddle figure text, need done css.

in example above, markup be:
<figure> <img src="#" alt="placeholder"> <figcaption> <h2>exhibit 1.1: example of something</h2> <p>lorem...</p> <p>ipsum...</p> </figcaption> </figure> figure { padding: 60px 10px 10px; position: relative; background: lightblue; } figure img { width: 100%; height: 50%; background: white; } figcaption h2 { position: absolute; top: 0; left: 0; padding: 10px; } this feels clunky me. assumptions figure wrong? acceptable mark close final appearance heading can reflow , easier reason about? in:
<figure> <h2>exhibit 1.1: example of something</h2> <img src="#" alt="placeholder"> <figcaption> <p>lorem...</p> <p>ipsum...</p> </figcaption> </figure>
your assessment spot on. here edited highlights of figcaption in action...
- you can have 1
<figcaption>element. - the
<figcaption>element optional. - everything else inside
<figure>treated being "the figure" caption relates (i.e. may multiple images, or code example etc) - if have lot of "caption" should go
<figcaption>element.
Comments
Post a Comment