Self-closing tags


#1


https://www.codecademy.com/en/courses/react-101/lessons/react-jsx-advanced/exercises/self-closing-tags?action=lesson_resume&link_content_target=interstitial_lesson


var profile = (


I AM JENKINS




I LIKE TO SIT
<br
JENKINS IS MY NAME
/>
THANKS HA LOT


);
no response , keeping running


Replace this line with your code.


#2

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.


#3

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.


3.

I AM JENKINS


4.
5.
6. I LIKE TO SIT
7. <br
8. JENKINS IS MY NAME
9. />
.....

);
but the exercise doesn't run?

#4

I restart the browser and it runs smoothly
Thanks;;


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.