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.

example of figure heading , caption

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...

  1. you can have 1 <figcaption> element.
  2. the <figcaption> element optional.
  3. everything else inside <figure> treated being "the figure" caption relates (i.e. may multiple images, or code example etc)
  4. if have lot of "caption" should go <figcaption> element.

Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -