Over a million developers have joined DZone.

Using HTML5 figures in today’s browsers

· Web Dev Zone

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

HTML5 includes tags for figures and figure captions. This post explains how to use them in modern browsers.

The following code can be used in HTML5 to display figures:
<img src="image.jpg">
<figcaption>This is the caption.</figcaption>
With the following CSS, the above code works in many modern browsers (tested in Firefox, Chrome, Safari).
    figure {
display: table;
text-align: center;
/* optional: border */
border: thin solid gray;
padding: 5px;
figcaption {
display: block;
Unfortunately, this might not work in some older browsers. You can experiment by replacing display:table with display:block (for figure), but then the border will fill the complete width of the page.

Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.


Published at DZone with permission of Axel Rauschmayer, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}