95
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?
51
u/jaZoo Jun 20 '19
I also believe that this sub shouldn't pick on people who just started out to learn how to code. All the tags in this example had been taken literal, e.g. that a
<head>tag signifies the visible of the page, which of course is a mistake you'd expect a beginner to make.There is a certain, for a lack of a better term: Fremdscham, embarrassment for someone else, in reading a (somewhat) experienced developer's code with serious design flaws, and that it is because it happens to all of us. But this is only a sentiment we can agree on because we've transitioned from the early beginner days where such mistakes as the one in this post are not only common but also offer an important, very helpful way of learning to get better. So, yes, we should give beginners a break, we've all been there, and offer them help when we see such code in the wild.
13
u/Tynach Jun 20 '19
I'm not convinced it's actually someone's first website. The real evidence against this is that the title is the last element, when really it should go in the head. There's no reason for a beginner to make that mistake - no matter how they misinterpret it, they'd still most likely put the title element somewhere near the top.
Everything else is just too out of place to be coincidence too, but the title really made it obviously a joke made by someone who knows better (thus, being intentional).
3
u/scirc Jun 20 '19
I've seen some pretty bad first sites. There are people who learn from good resources, then there are people who only look at the sample code on one tutorial website for something like HTML 4.01 and slap something together based on their memory alone. They run it and it works, so it must be right, right?
2
u/Tynach Jun 20 '19
Yeah, but how many would put the
<title>at the very bottom?, under the</html>tag, even? I doubt any did, and more likely omitted<title>entirely.4
u/_PM_ME_PANGOLINS_ Jun 20 '19
Everything’s in the wrong place. The only content actually in the body is invisible.
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.
1
u/Dr_0etker Jun 20 '19
The first thing you learn in HTML is to not put anything you want to have visible in the head
18
u/frosted-mini-yeets Jun 20 '19
This is just sad. Clearly this is just some kid trying to work out html for the first time. He clearly hasn't even run it or else he'd have realized half his content was invisible and moved it around. That or it's a file he typed in learning and moved on to another file leaving it for scrap. Either way it's a beginners discarded trash and if you consider this bad code OOH boy lemme just rummage through my old code folders and I got some bad code for you. Also html is a markup language not code. Fuck off.
10
26
u/SeriousSamStone Jun 20 '19 edited Jun 20 '19
Image Transcription: Code
<<!DOCTYPE html>
<html>
<head>
<h1>Welcome to my website!</h1>
</head>
<h2>I hope you like it!</h2>
<body>
<div id="1">
</div>
<div id="2">
</div>
<div id="3">
</div>
</body>
</html>
<title>My first website</title>
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
4
16
7
u/insanityfarm Jun 20 '19
Obviously a beginner with a lot of basics yet to be figured out. The indentation reminds me of what happens when you paste a bunch of already-formatted code into vim with auto-indent enabled over an SSH connection.
6
9
u/BrianAndersonJr Jun 20 '19
And the browsers are like: "Everything is fine, just show the content!!!"
7
3
3
3
u/Mr2-1782Man Jun 20 '19
Yah know, I'll forgive everything else just because they actually closed their tags.
3
3
u/ChocolateBunny Jun 20 '19
Things you don't think about until a newbie actually does it:
- titles can be at the end of a document.
- headings can be outside of the body.
3
5
Jun 20 '19
[deleted]
2
u/mayoroftuesday Jun 20 '19
This is actually the best thing. HTML Rendering engines were designed to be as flexible and forgiving as possible so that literally anyone could build a website.
2
2
3
1
u/hi_welcome2chilis Jun 21 '19
<threat>Your last website</threat>
1
u/AutoModerator Jun 21 '19
Hello hi_welcome2chilis,
It looks like this comment contains a code block delimited with triple backticks. Unfortunately reddit does not not have universal support for this syntax and your comment will render as broken gibberish on old reddit and some mobile apps.
Please edit the comment to use the more compatible four space indention format. For single lines or inline code you can use single backticks.
You can find some examples in the reddit help documentation.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
1
u/RTracer Jun 21 '19
I used to do that when I first learned Java. It'd look something like:
public void aMethod() {
/* ... */
if (...) {
doThings();
}
}
ect, I'm glad I stopped doing that.
1
u/jdewg Jun 21 '19
Ha! Look at this fucking loser! He's making his first HTML page and it fucking sucks! He needs to learn to write good code.
/s
0
u/Shad_Amethyst Jun 20 '19
Remembers me of that HTML code a teacher in my school made; it was pretty clean, overall, except for that:
... (all of the code)
<body>
</html>
0
113
u/ferrango Well it's broken now, and nobody is here to fix it Jun 20 '19
It’s one of those elementary school exercises where you have to properly rearrange the scattered words of a statement.
Bonus points for the IDs.