Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

Jacob Tennyson
Jacob Tennyson
6,240 Points

Posting video from youtube

So heres my code, i cant seem to figure out how to put a video from youtube on my page ...

<!DOCTYPE html>

<html>

<head lang="en">
  <meta charset="utf-8">
  <link rel="stylesheet" href="main.css">
  <link href='http://fonts.googleapis.com/css?family=Merriweather' rel='stylesheet' type='text/css'>
</head>
<body>
  <div class="main-wrapper">
    <header class="main-header">
      <h1 class="main-logo"><a href="index.html">H</a></h1>
      <ul class="main-nav">
        <li>
          <a href="location.html">t</a>
        </li>
        <li>
          <a href="gear.html">t</a>
        </li>
        <li>
          <a href="#">t</a>
        </li>
       </ul>
    </header>

    <iframe width="1280" height="720" src="//www.youtube.com/embed/PqFFQB64JS8" frameborder="0" allowfullscreen></iframe>

    <footer class="main-footer group">
      <p> &copy; </p>
    </footer>
  </div>

</body>

</html>

and all i get is a unable to access file link

Jacob Tennyson
Jacob Tennyson
6,240 Points

html...

<iframe width="1280" height="720" src="//www.youtube.com/embed/PqFFQB64JS8" frameborder="0" allowfullscreen></iframe>

...

i dunno wtf is going on but my code wont show up

Craig Watson
Craig Watson
27,930 Points

Hi Jacob,

Are you gathering the embed code from YouTube and pasting it directly into your HTML ?

Craig

Tweaked your Markdown for you and fixed a couple typos in your code. :) The backtick (`) used to delimit code blocks is the key just above your tab key.

1 Answer

Try placing a http: at the beginning of the iframe's src attribute and see if that works:

<iframe width="1280" height="720" src="http://www.youtube.com/embed/PqFFQB64JS8" frameborder="0" allowfullscreen></iframe>