by nathell · 2y ago · 0 comments
<body background="animals.jpg">
<center>
Exactly as I would do it if I were a 7yo. Speak what you will about the virtues of CSS and semantic markup, these things get in the way of having fun. And can be learned later.Like compare that mess to the elegant semantic structure of a state of the art webpage like google.com
<div class="gb_Ld"><div class="gb_Xc"><div class="gb_k gb_Fd gb_z" data-ogsr-fb="true" data-ogsr-alt="" id="gbwa"><div class="gb_f">> Open up wide! Here comes some 'content'! Quit complaining, you can handle it!
I still use tables (seriously).
Look, it works and lets me move on to stuff that matters.
Later I learned that having 3 or more different ways to get an identical result is... time-consuming, at best. When they all might work slightly differently depending on several layers of context (or just not work), you realize CSS is ripe for massive pain points to spring up, and they can happen unexpectedly. I understood why everyone else hated CSS - under time pressure, it's just not worth dealing with 99.9% of the complexities for immeasurably small + abstract returns.
Eventually, I determined that I both love and despise CSS in different aspects. It's complex enough to hold both attitudes. And I'm very, very satisfied that Tailwind came along and (nearly) perfected what Bootstrap et al were figuring out before it.
We had used Bootstrap and similar frameworks for years prior, but all the battling with different CSS layout techniques to render the UI on this project made me realize I was wasting my time, and the fact that the designer couldn't give developers working CSS made me wonder if the entire promise of separating design from functionality was a mirage.
<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.Hard disagree on both points.
Disclaimer: I'm not found of web techs...
Also, there's nothing XML-but-not-actually about HTML. Both HTML and XML are derived from SGML.
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.
Have you met any 7 year olds? Have you taught any beginners to do computer stuff?