Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h3>A demonstration of how to access a FIGCAPTION element</h3> <figure> <img src="/tags/img_pulpit.jpg" alt="The Pulpit Rock" width="304" height="228"> <figcaption id="myFigCap">Fig.1 - A view of the pulpit rock in Norway.</figcaption> </figure> <p>Click the button to set the color of the caption to red.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { var x = document.getElementById("myFigCap"); x.style.color = "red"; } </script> </body> </html>