Hacker News new | ask | show | jobs
by skgough 696 days ago
I agree with you, but for shits and giggles, to modify this to be evangelist compliant, you could write this instead:

    <body style="background: url('animals.jpg')">
        <div style="text-align: center">
Which isn't much more complicated, and makes it clearer what's going on. I wonder if there is a transpiler like Elm that could take a single file written in a simplified language and gave you an HTML5 compliant webpage? You could argue that all the XML-but-not-actually-XML crap in HTML (angle brackets, closing tags, escaping special characters with HTML entities...) is also an impediment to beginners.
3 comments

> Which isn't much more complicated, and makes it clearer what's going on.

Hard disagree on both points.

What is the value of writing all of that, compared to the simpler approach? What will you want next in your quest of purity? Forbidding inline styles in the name of security, maybe?

Disclaimer: I'm not found of web techs...

Are you serious? Embedding a language (CSS) into the string literals of another one (HTML) is of course much more complicated, and needlessly so.

Also, there's nothing XML-but-not-actually about HTML. Both HTML and XML are derived from SGML.

The kid doesn't have to know that's it's CSS, and `style="background: url('animals.jpg')"` is more clear than just `background` because it explicitly states that this a networked resource that is being retrieved with the url() function. If you tried to set the `background` attribute to "blue" it wouldn't do anything, because you have to use the `bgcolor` attribute to color the background of the page. But the `background` property in CSS is a shorthand, so you can set it to a named X11 color, or a gradient, or an image file, and these all work.

The `<center>` element spans the width of it's container, is only as tall as it's content, and only centers the content contained inside it horizontally, but this isn't immediately obvious just from looking at the element's name. Using `text-align: center` instead is a much more obvious way to describe what the `<center>` element is actually doing.

Yes, this is more complicated, but it is more obvious, which, I think, is more useful when someone is learning a complex topic.

If I wasn't in bed on my phone I would disagree at length and in great detail with this.

Have you met any 7 year olds? Have you taught any beginners to do computer stuff?