I have a quick question an issue that I have with my project.
Currently, I am working on a FCC survey page and when I analyzed my HTML I was given an error saying that I don’t have a start tag for
body. I am a bit puzzled because I do have the start tag for it. Could someone explain to me why this is so ?
Thank you in advance!
<body> is where your page content is put. In Codepen, the HTML frame is actually the body itself. You dont have the declare it. Its already there, behind the scene. Whatever you write in the codepen HTML frame is already inside the body. You can have only one body.
Your page has some messed up element closing tags. Look on the left of your code, where line numbers are listed. Next to each element tag you can see an arrow. By clicking it, you can fold/unfold the element content. Use that feature to fold large elements so you can better see where you have unclosed tags. The false body tag you created, you can change it to a
main tag. This will be more syntactically correct.
PS: you can get rid of the div which wraps your whole document, with the id
main. You can directly style your whole document by targeting the
body tag in CSS
As mentioned, for codepen, you don’t need body tags. So you can just delete those.
Also, please don’t use br tags like this.
Labels and inputs are inline elements.
If you want to change them to block level and add space on the top and bottom then you can do that in css.
Hi @Sylvant !
Thank you for your patience!
And noted! That’s def something new I learned and will avoid doing in the future! Also, thank you again for the tips! They’re all valuable to me in becoming a better coder.
Hi @jwilkins.oboe !
Thank you for your patience as well as the tip!
That’s definitely something I’ll be sure to avoid as I do want to practice proper, clean coding. It is something I often get confused about as I learn coding i.e. if there is a “right”/“wrong” way to code if it yields same or similar results - for example, say to change two boxes of color that are side by side you can flip it by using row-reverse, or you can use the order to flip the colors. Would the approach make a difference as long as it yields the same result? (I hope that made sense… ) It’s difficult to decipher when to use what code for what.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.