Back to Freecodecamp

Step 4

curriculum/challenges/english/blocks/workshop-build-a-video-display-using-iframe/68ba9c4f1688914d72876095.md

latest1.0 KB
Original Source

--description--

The iframe element also takes an src attribute with a value that indicates the URL or the path of the resource to display.

Add an src attribute of https://www.youtube.com/embed/I0_951_MPE0 to your iframe element.

At this point, you should see the video displaying on the page, but there are some more attributes you need to add.

--hints--

Your iframe element should have an src attribute set to https://www.youtube.com/embed/I0_951_MPE0.

js
const iframeEl = document.querySelector('iframe')
assert.equal(iframeEl?.getAttribute('src'), 'https://www.youtube.com/embed/I0_951_MPE0')

--seed--

--seed-contents--

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Display Videos in an iframe</title>
  </head>
  <body>
    <h1>iframe Video Display</h1>
    <iframe
      width="560"
      height="315"
--fcc-editable-region--
      
--fcc-editable-region--
    >

    </iframe>
  </body>
</html>