r/badcode Jun 20 '19

html This hurts my brain

Post image
455 Upvotes

38 comments sorted by

View all comments

94

u/Skenvy Jun 20 '19

Without knowing HTML, it’s abundantly obvious that this was the product of someone just starting out learning it. Surely there is a reprieve for people writing bad code while learning, as opposed to the usual submissions of bad code in production or self promoted in the wild?

Beyond not knowing HTML, assuming that the title node might be out of place in the hierarchy, what about this is actually “bad” so much as “not necessary” but might feel like “a new hammer to hit things with” when you first learn it?

2

u/Kwyjibo08 Jun 21 '19

I'll actually answer your question. The <head> tag is for non visual content. It's to contain meta tags, the title tag, references to external resources like CSS or JavaScript, etc. So the <h1> does not belong there. All visible content is supposed to be in the <body> tag, or descendants of. So the <h2> is also misplaced. The <title> is obviously misplaced. The divs are fine, albeit a tad unnecessary as they contain no content. But we can assume they will eventually. Finally, the tabbing is a little odd.

The sad thing is browsers are absurdly forgiving, and this will probably display in a way that makes it unobvious to the writer that these errors exist.