Self-closing tags

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/en/courses/react-101/lessons/react-jsx-advanced/exercises/self-closing-tags?action=lesson_resume&link_content_target=interstitial_lesson

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
var profile = (

I AM JENKINS

I LIKE TO SIT
THANKS HA LOT
); no response , keeping running ```

Replace this line with your code.

<do not remove the three backticks above>

HTML is a prerequisite for this course. Learning JSX before HTML will only add to the difficulty. The same can be said of CSS and JavaScript which are also core subjects.

A self-closing tag, also known as a void element contains no child elements or text node. That’s why they don’t need closing tags (also known as ENDTAGs). Everything they need is contained in their attributes, if that are any.

Elements such a linebreak, <br>, horizontal rule, <hr>, <input> and <img> are self-closing, the latter two contain attrtibutes.

In XML compliant HTML we must include the / in the tag. HTML5 permits us to not include a space character, so we may write,

<img/>

or

<img />

React.js requires that we use the XHTML syntax, and always include a space. We cannot break up a self-closing tag. It must appear on the same line.

<br />

Something we learn in HTML is that line breaks in our markup and content do not result in a line break on the screen. That is why we use <br />; to force a line break.

1 Like

thanks mfg, my point is that in 2/16 React.js: part1 (In app.js, fix the broken JSX by adding slashes to all of the self-closing tags.)) I added tags :

  1. var profile = (
  2. <h1>I AM JENKINS</h1>
    
  3. <img src="images/jenkins.png" />
    
  4. <article>
    
  5.   I LIKE TO SIT
    
  6.   <br
    
  7.   JENKINS IS MY NAME
    
  8. />
    
); but the exercise doesn't run?