HTML5 – The figure & figcaption elements

May 26th, 2012 by Laeeq | 2 comments

HTML5 introduces many interesting elements like audio, video, Canvas, Drag and Drop, SVG, figure, figcaption etc. Here in this article we we’ll discuss figure and figcaption elements. Actually the <figure> element is used in conjunction with <figcaption> element to mark up photos, diagrams etc.

The <figure> element:

As above mentioned, The <figure> element is used with the element to mark up photos, diagrams etc.

An image within a <figure> element without a caption:

blue footed boobie bird

 

Example code:

  1. <figure id=“figure”>
  2. <img src=“img/blue-footed-boobie-bird.jpg” alt=“blue footed boobie bird”>
  3. </figure>

 

The <figcaption> element:

The <figcaption> element is used with <figure> element. it is used to add captions, explanations within image. it can be apear before or after the content within the <figure> . We can add only one element within a element, although the <figure> element itself may contain multiple other child elements.

Figure with an image and caption:

flying solo bird photography

This is flying solo bird photography

 

Example code:

  1. <figure id=“figure”>
  2. <img src=“flying_solo_bird_photography.jpg” alt=“flying solo bird photography” title=“flying_solo_bird_photography” />
  3. <figcaption>This is flying solo bird photography</figcaption>
  4. </figure>

 

A figure with multiple images

Here we we’ll nest multiple images within one <figure> element with a single caption:

beautiful birds normal

Puffin

wings birds

 

This is a nest multiple images caption

 

The example code:

  1. <figure id=“figure”>
  2. <img src=“beautiful_birds-normal.jpg” alt=“beautiful birds normal” />
  3. <img src=“Puffin.jpg” alt=“Puffin” />
  4. <img src=“wings_birds_photo.jpg” alt=“wings birds” />
  5. <figcaption>This is a nest multiple images caption</figcaption>
  6. </figure>

You can subscribe to PHPZAG.COM posts by Email

 

Related Topics:

  • HTML5 Canvas Element
  • Popular Free HTML5 and CSS Templates
  • Web forms with new HTML5 features
  • HTML5 placeholder Attribute
  • Simple Slider with HTML5 Range Input Type
  • What is HTML5?
  • New Elements in HTML5
  • XForms – The new Web standard for forms
  • Magento Interview Questions and Answers
  • HTML5 interview questions and answers
  • About HTML5 Audio Standards
  • HTML 5 compatible browsers
  • Php Interview Questions and Answers – Part 1
  • Php Interview Questions and Answers – Part 2
  • Php Interview Questions and Answers – Part 3
  • PHP Interview Questions and Answers – Part 4
  • Php Interview Questions and Answers – Part 5
  • Php Interview Questions and Answers – Part 6
  • Php Interview Questions and Answers – Part 7
  • Php Interview Questions and Answers – Part 8
  •  

     

    1. May 27th, 2012 at 10:39 | #1

      Hi !

      My name is Shipra Bhatia. I am representing Innobuzz Knowledge Solutions P. Ltd.

      We have read your blogs on http://www.phpzag.com/ and found the content to be very interesting and resourceful.

    2. zoeywatsonty
      October 3rd, 2012 at 07:37 | #2

      I just couldn’t leave your website before suggesting that I really loved the standard information an individual provide for your guests? Is gonna be back frequently in order to check out new posts.

    1. No trackbacks yet.