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 HTML Video and Audio Media Basics The Video and Source Elements

what self - closing

how do you self close

index.html
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML Video and Audio</title>

    <link rel="stylesheet" href="normalize.css">
    <link href='http://fonts.googleapis.com/css?family=Nunito:400,300' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="main.css">
  </head>
  <body>

    <source><video> <h1>HTML Video and Audio</h1></video></source>

    <div class="wrapper">

      <!-- Add your code below this line -->


    </div>

  </body>
</html>

3 Answers

Hi D'airreon Henley ,

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML Video and Audio</title>

    <link rel="stylesheet" href="normalize.css">
    <link href='http://fonts.googleapis.com/css?family=Nunito:400,300' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="main.css">
  </head>
  <body>

    <h1>HTML Video and Audio</h1>

    <div class="wrapper">

      <!-- Add your code below this line -->
      <video /

    </div>

  </body>
</html>

You can create a self closing tag by

<video />

Thank you

Reference : http://blog.teamtreehouse.com/to-close-or-not-to-close-tags-in-html5 https://stackoverflow.com/questions/3558119/are-non-void-self-closing-tags-valid-in-html5 https://www.quora.com/Which-HTML-tags-are-self-closing

Amrit Pandey
Amrit Pandey
17,595 Points

Nick refers to open tag when he says Self Closing, It simply means you do not have to add another closing tag to wrap the element.

for example <img> tag, there is no </img> tag to close it, it is therefore a self closing tag

But <h1> tag, has </h1> tag to close it.

Adam Pengh
Adam Pengh
29,881 Points

A self closing element is an element that doesn't need a closing tag. I've included an example below for this challenge and some additional information from a Treehouse blog post (http://blog.teamtreehouse.com/to-close-or-not-to-close-tags-in-html5)

<video>
  <source src="">
</video>

You can also find more information about video tags here: https://www.w3schools.com/html/html5_video.asp