3 ms·
>I actually don't think it's that bad of a practice as no browser will ever stop supporting it It's not a bad practice to use center because it's not HTML5-com
by ivanbakel 6y ago
>I actually don't think it's that bad of a practice as no browser will ever stop supporting it
It's not a bad practice to use center because it's not HTML5-compliant (though that's not a bad reason to avoid it). It's bad practice because putting purely visual info in your semantic markup is a bad idea - mixing responsibilities between different layers creates pain points for later work.
In this sense, it's like a GOTO. It'll work well enough for one person on a small project, and you might thumb your nose at the experts who tell you it's a bad idea - but it's a source of technical debt, and the better approach is to just avoid it from the start.
- calibas 6y agoAnother perspective: It's bad practice to constantly change everything every few years, then expect everyone to upgrade to the latest and greatest technology or get left behind. It's good practice to use code that runs just fine on a 20 year old system.
- ivanbakel 6y agoAnd yet the change to <center> is not "a few years old". It was deprecated back in 1997 as part of HTML4, because it was never deliberately introduced as a standard tag - <center> only exists because Netscape Navigator was once influential enough to force tags into existence, and it did so, even though the concept itself was flawed. Centering HTML elements through CSS has existed since 1997 as well, specifically because CSS aimed to make those HTML extensions, that Navigator had introduced, obsolete. Standards bodies sometimes have to make the tough decision of breaking with the past to safeguard the future. Software longevity is a worthwhile cause, but protecting a 23-year-deprecated, non-standard HTML tag, whose use is bad engineering, is not the kind of hill I would die on.
- calibas 6y agoFor the record, I don't think using <center> is a good idea. I'm not arguing for it's use, I just don't believe it's as horrible as some people make it out to be. Despite the valid arguments against it, it works and it will likely continue to work.
- calibas 6y ago>And yet the change to <center> is not "a few years old". Also, if you're going to quote someone, quote what they actually said.
- ivanbakel 6y agoWhat part of that quote did you feel is an inaccurate paraphrasing of what you said? Were you not insinuating that <center> was a victim of change that happens "every few years"? If not, why did you bring it up?
- calibas 6y ago>And yet the change to <center> is not "a few years old". Changes happen every few years as browser support shifts. That's a fact, right? I don't know why you're explaining to me the history of <center> as if I don't know it already or believe these changes are new. I mentioned "a 20 year old system" for a reason. Heck, the fact that it's been deprecated for so long and none of the browsers care is more of an argument for the use of <center>.
- ivanbakel 6y ago>Changes happen every few years as browser support shifts. That's a fact, right? What does this mean? That browser support is constantly improving, and that over time, new features arise that allow for better architectures and neater code? Yeah, sure. That's not relevant to <center>, though. That your typical web code is full of rot, and frontend web engineers can be prone to chasing the next big framework? I'd concede that, though I think the alarmism about code rot is very overblown. That browsers themselves are fast-moving targets in a way that negatively impacts code lifetimes? Hell no. HTML standards are slow. The gap between <center> being deprecated and removed was 11 years. More to the point, the only code that rotted in those 11 years was bad HTML - which mixed visual tags into a semantic markup. >I don't know why you're explaining to me the history of <center> as if I don't know it already or believe these changes are new. Because I don't otherwise understand why you would bring up the idea of "changing everything every few years" being bad practice. If you already know that <center> was not abandoned as part of a short-lived fad, then what did that have to do with defending it? Why, when I pointed out that <center>'s demise is not because of the snobbishness of web devs, but instead because it was flawed from the very beginning, both in its invention and its concept, did you start talking about software with a fast rate of change? What was the point you were trying to make - that the fact that <center> is 12 years past its death date, and 21 years past its deprecation date, but people are still making the mistake of using it, is somehow a win for long-lived code?