Over a million developers have joined DZone.

Using HTML5 figures in today’s browsers

DZone's Guide to

Using HTML5 figures in today’s browsers

· Web Dev Zone ·
Free Resource

Jumpstart your Angular applications with Indigo.Design, a unified platform for visual design, UX prototyping, code generation, and app development.

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.

Take a look at an Indigo.Design sample application to learn more about how apps are created with design to code software.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}