Why do we add a space before /


I'd like to know why there is a space before the forward slash for the below code.
Do I have to add the space and if so why?

Thank you in advance for your help.

<img src="" alt="A field of yellow sunflowers" />


its xml syntax, if you use xml, you have to use this syntax

for html you can just do:

<img src="#">

some lessons require xml syntax


Thanks. And sorry for the confusion. I was referring to the space right before the forward slash. E.g. sunflower" />.

Is adding a space a best practice?


that is part of the xml syntax, without the space, its not valid xml syntax


So then for the following, I don't need to worry about the space since I have the link address to the image?

<img src="https://s3.amazonaws.com/codecademy-content/courses/web-101/web101-image_brownbear.jpg" alt="brown bear" />


you could even leave out the forward slash if you are using html


Perfect. Got it. Thanks for the quick response! :slight_smile:


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