No need to apologize for asking questions - that’s why the forum exists.
is it considered bad form not to have html, head, and body tags?
Yes, you absolutely, always need
body tags. Always. Errr… unless you’re in something like codepen and then you definitely don’t need them. Codepen is an artificial environment that holds your hand and takes care of some things behind the scenes. Ordinarily you would put
html tags to identify it as html, but in codepen, everything in the
html pane is by definition html so it is redundant. In a
head tag you would put information about your app that you don’t need to appear on the screen. Yes, the title, but also meta data (you mentioned search engines) and it’s common to link to external CSS and JS files there - another thing codepen makes unnecessary - but these could also be put in other places in the file You also don’t need a
body tag in codepen - the only thing codepen wants you to put in the html pane is what would go in the body anyway to the tag is redundant.
So, none of those tags are need in codepen and actually get in the way. And with a “real” web page, they are technically not needed, but it is considered improper to not have them and may cause problems in some cases.
If you want to see what your codepen app would look like in the real world, go into your edit view, and in the lower right corner is a button “Export”, select “Export .zip”. This will give you a zip that you can save and extract locally that will set up the same app to run on your computer, setting up a very basic file structure and put the
body tags where they belong. This is a working app - double click on the main html file.
Saving it locally is a good idea to do anyway, to save your code. And it wouldn’t hurt to start saving your finished apps on github anyway.
Another way to see how “real” html is constructed is just to go to any web page, right click and select “inspect”. This will show you the actual HTML from the server. For many sites, this can be dense and be information overload, but it can be interesting to do, also.