תגית <figure>
היא תגית עצמאית העוטפת תמונה או גרף במסמך ה-HTML ומאפשרת להוסיף להם כותרת באמצעות תגית משלימה <figcaption>.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
קטגוריה | תגיות להזנת תוכן. |
---|---|
תוכן מורשה |
<figcaption>,<img>,<abbr>, <audio>, <b>, <bdo>, <br>, <button>, <canvas>, <cite>, <code>, <command>, <data>, <datalist>, <dfn>, <em>, <embed>, <i>, <iframe>, <img>, <input>, <kbd>, <keygen>, <label>, <mark>, <math>, <meter>, <noscript>, <object>, <output>, <progress>, <q>, <ruby>, <samp>, <script>, <select>, <small>, <span>, <strong>, <sub>, <sup>, <svg>, <textarea>, <time>, <var>, <video>, <wbr> |
תגיות הורים מורשות | תגית זו מורשת להופיע בגוף המסמך אך אינה חייבת להיות כפופה בצורה ישירה אל תגית <body> . |
ממשק DOM | HTMLElement |
תארים
תגית זו נכללת ברשימת התארים הגלובליים.
-
דוגמא - תמונה
<!-- Just an image --> <figure> <img src="https://developer.cdn.mozilla.net/media/img/mdn-logo-sm.png" alt="A robotic monster over the letters MDN."> </figure> <!-- Image with a caption --> <figure> <img src="https://developer.cdn.mozilla.net/media/img/mdn-logo-sm.png" alt="A robotic monster over the letters MDN."> <figcaption>MDN Logo</figcaption> </figure>
דוגמא - קטע קוד
<figure> <figcaption>Get browser details using <code>navigator</code>.</figcaption> <pre> function NavigatorExample() { var txt; txt = "Browser CodeName: " + navigator.appCodeName; txt+= "Browser Name: " + navigator.appName; txt+= "Browser Version: " + navigator.appVersion ; txt+= "Cookies Enabled: " + navigator.cookieEnabled; txt+= "Platform: " + navigator.platform; txt+= "User-agent header: " + navigator.userAgent; }</pre> </figure>
דוגמא - שיר
<figure> <p style="white-space:pre"> Bid me discourse, I will enchant thine ear, Or like a fairy trip upon the green, Or, like a nymph, with long dishevell'd hair, Dance on the sands, and yet no footing seen: Love is a spirit all compact of fire, Not gross to sink, but light, and will aspire.</p> <figcaption><cite>Venus and Adonis</cite>, by William Shakespeare</figcaption> </figure>