What is <figure> tag?

 

Experience Level: Junior
Tags: HTML

Answer

The  <figure> tag is for self-contained content, frequently with a caption <figcaption> and is typically referenced as a single unit.  Usually a <figure>  is an image, illustration, diagram, code snippet, etc., that is referenced in the main flow of a document, but that can be moved to another part of the document or to an appendix without affecting the main flow.

E.g. if you wont to disply on your web page code example you can firs the <> ; , writte like en code. Without that the code won't be desplayed.

Example
<html>
<head>
    ...
</head>
<body>
    <figure class="code-example">
        <figcaption>Example</figcaption>

<pre>
<code class="language-html">&lt;p&gt;
	Have you ever seen &lt;i&gt;lorem ipsum&lt;/i&gt; phrase before?
&lt;/p&gt;</code></pre>
    </figure>
</body>
</html>

Comments

No Comments Yet.
Be the first to tell us what you think.