TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Mistakes in the Design of CSS (2013)

112 pointsby ARCarrover 1 year ago

24 comments

locallostover 1 year ago
The list reminds me of when people refactor code and then just rename things. Ok, foo should&#x27;ve been called bar, but is that really a design mistake? The biggest design mistake for me is that it contains the letter C - it never should&#x27;ve been cascading. There&#x27;s probably a need to resolve conflicting rules but it never should&#x27;ve been THE feature around which the language is designed. The precedence algorithm, the specificity etc. has been a source of endless bugs because you almost never know if somewhere somehow an outdated selector is messing everything up in a hidden place far away from what you&#x27;re actually doing.<p>Instead the core features should&#x27;ve been simple ways to, well, style. From the beginning you should&#x27;ve been able to e.g. position vertically. There&#x27;s a huge list of these issues where for a long time the simplest things were difficult and involved too much thought to get anything done. Granted things have improved, but the main issue I have is that standards like CSS should be more practice driven, e.g. what are the things I want to get done and how do I do that. Instead this is how you will override a selector as if that&#x27;s the most important thing.
评论 #38376109 未加载
评论 #38377464 未加载
评论 #38376117 未加载
评论 #38378739 未加载
dangover 1 year ago
Related:<p><i>Incomplete List of Mistakes in the Design of CSS</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=25891435">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=25891435</a> - Jan 2021 (68 comments)<p><i>Incomplete List of Mistakes in the Design of CSS</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=18297757">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=18297757</a> - Oct 2018 (150 comments)<p><i>Incomplete List of Mistakes in the Design of CSS</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10453850">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10453850</a> - Oct 2015 (106 comments)<p><i>Incomplete List of Mistakes in the Design of CSS</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7665667">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7665667</a> - April 2014 (1 comment)
eternityforestover 1 year ago
Make flexbox the default layout for everything, and add a flex-snap feature that will snap to the nearest multiple of some given size. I&#x27;m not sure we actually would still need grids.<p>I also wonder if you couldn&#x27;t have a more transparent and parameterizable auto width algorithm based on a lowest cost solver.<p>So you could say &quot;If this element wraps, it&#x27;s cost 50&quot;, meaning you want all the boxes to stay on as few lines as possible. Or &quot;Every em of height this element has is cost 10, if anything triggers a scrollbar, that&#x27;s cost 100&quot;.<p>Maybe instead of flex-grow, you&#x27;d just add negative cost to the width of something.<p>You could have alternate rulesets so the browser could choose one or the other for lowest overall page cost.<p>Also, class inheritance. I don&#x27;t see why that&#x27;s not a thing. &quot;Not needing processors&quot; should be a pretty big design goal.
评论 #38374387 未加载
评论 #38373385 未加载
评论 #38376545 未加载
Izkataover 1 year ago
&gt; Box-sizing should be border-box by default.<p>It was in Internet Explorer, everything being misaligned because of this difference was one of the reasons it got the nickname Internet Exploder.<p>Edit: To be clear this was more of just a fun fact, I agree with this statement. The misalignment was because people would build to content-box without knowing it was different in IE. Worse still IIRC they acted differently even before this CSS attribute was exposed, so you had to make it work both ways if you wanted your site to look nice everywhere.
__jonasover 1 year ago
&gt; background-position and border-spacing (all 2-axis properties) should take <i>vertical</i> first, to match with the 4-direction properties like margin.<p>I hate that margin &#x2F; padding short-hands, especially with 2 values, expect vertical first.<p>In my head it&#x27;s always (x,y) and (width,height) – always horizontal then vertical, I feel like it works like this everywhere else?<p>Now my issue is that I&#x27;ve committed to memory that margin and padding short-hands work the exact opposite way I would expect, so sometimes I still mix them up because I type them &#x27;correctly&#x27; and then flip them because I memorized it like that..
评论 #38365542 未加载
评论 #38364940 未加载
评论 #38366449 未加载
CM30over 1 year ago
Personally, I think box-sizing being content-box by default was probably the biggest misstep here, and something that genuinely feels at odds with how 99% of the population would design or build something. The fact IE got it right initially and then it took another few years to even get things fixed across the board just feels utterly ridiculous to me.<p>Also, not having something like Flexbox or Grid earlier on was another mistake that should have been listed too. The fact we had to resort to hacks related to floats and table layout to create basic layouts was an absolute joke, and indicates that the creators at the time had no idea what a site or application would usually be like design or functionality wise.
codedokodeover 1 year ago
&gt; The top and bottom margins of a single box should never have been allowed to collapse together automatically as this is the root of all margin-collapsing evil.<p>Disagree. All margins, including horizontal, should collapse. Typically you want 20px between buttons, not 20 + 20.
评论 #38373610 未加载
评论 #38365698 未加载
评论 #38379605 未加载
评论 #38377247 未加载
pprotasover 1 year ago
While many of these are obvious and don&#x27;t need further explanation, the article would benefit a lot from showing a few simple examples for some of these items, or a justification for why the author&#x27;s proposed naming is better.
评论 #38364748 未加载
danielvaughnover 1 year ago
Backwards compatibility may be a fundamental design philosophy of the web, but wouldn&#x27;t it still be possible to support a different document format with a new programming model that gives us a clean break from the past? It&#x27;s a naive question, I realize, but it&#x27;s tantalizing to imagine what we could have if we went that route.<p>Then again, the cynic in me thinks we&#x27;d just endlessly fight over the design decisions anyways.
评论 #38366005 未加载
评论 #38365036 未加载
评论 #38365509 未加载
评论 #38364991 未加载
评论 #38376585 未加载
PaulHouleover 1 year ago
I thought &quot;!important&quot; was always about appealing to the emotions of overwhelmed and confused CSS authors as it seems to make the computer &quot;listen to you&quot; when it doesn&#x27;t seem to be.<p>I remember this notorious book<p><a href="https:&#x2F;&#x2F;www.amazon.com&#x2F;Creating-Killer-Sites-David-Siegel&#x2F;dp&#x2F;1568304331" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.amazon.com&#x2F;Creating-Killer-Sites-David-Siegel&#x2F;dp...</a><p>about techniques used to get pixel perfect results with HTML back in the 1990s. The author of that book was quite impressed with CSS as it really does give designers great tools to work with, but it&#x27;s still got the problem that designers find it hard to be disciplined with. That is, a lot of designers are stuck in a &quot;let&#x27;s draw a pretty picture&quot; mindset but find it hard to think like &quot;let&#x27;s develop a system that makes it easy to draw lots of pretty pictures&quot;. Thus we get a lot of things like bootstrap and tailwind that erode the idea of CSS classes being somewhat semantic and being related to the structure of the system (e.g. this <i>particular</i> toolbar as it manifests in this application) as opposed to &quot;a generic toolbar that comes out of a framework&quot; or &quot;something that has 15px of margin&quot;.)
评论 #38367359 未加载
评论 #38365924 未加载
评论 #38366075 未加载
评论 #38365326 未加载
评论 #38379771 未加载
评论 #38373416 未加载
Jeema101over 1 year ago
&gt; z-index should be called z-order or depth and should Just Work on all elements (like it does on flex items).<p>Z-index is one of the most aggravating things I&#x27;ve run into with CSS. It should always Just Work as the author says and be absolute across the whole page and intuitive. But it isn&#x27;t. And every time I run into a problem where it&#x27;s not behaving in the way I expect, I have to once again Google &#x27;z index not working&#x27; and refresh my memory on all the reasons why it might not be working with the specific example I&#x27;m dealing with.
评论 #38379806 未加载
stevageover 1 year ago
&gt; It shouldn&#x27;t be `!important` — that reads to engineers as “not important”. We should have picked another way to write this.<p>Oh absolutely. Even `important!` would have been better.
评论 #38375598 未加载
matheusmoreiraover 1 year ago
Why can&#x27;t there be aliases for those names? I&#x27;d certainly use them. Is there a reason nowrap and no-wrap can&#x27;t both work?
epupsover 1 year ago
ChatGPT is a CSS deity, I have been using it lately and have been impressed by it. I suppose it&#x27;s because so many issues were raised about it, so it is now trained on every possible mistake you can make
Animatsover 1 year ago
It shouldn&#x27;t have had inheritance by default. It was designed at the height of object-oriented programming, and so it had to have inheritance. This results in blocks of CSS turning off stuff in case some outer CSS turned it on.<p>It really should have been a constraint system. Layout should be something that says that X is to the right of Y, Y is below Z, A and B have the same height, etc. But people didn&#x27;t really know how to do those back then. See the 2D sketching system in Autodesk Inventor&#x2F;Fusion to see this done right. That can do more than boxes (it understands curves) but web layout should probably just be boxes.<p>Maybe it shouldn&#x27;t be textual at all. Maybe layout should be designed entirely in graphical tools.<p>Cannot put text on top of text. Boxes must be disjoint. If you want another layer, OK, but layers should work like windows.
noelwelshover 1 year ago
No, the biggest mistake in the design of CSS is not realizing they are designing a programming language, and consequently not adding means for abstraction and composition. Less, Sass, Tailwind etc. would not exist if abstraction and composition existed in CSS. This list is just a layer of paint.
评论 #38377895 未加载
评论 #38377685 未加载
creataover 1 year ago
&gt; rgba() and hsla() should not exist, rgb() and hsl() should have gotten an optional fourth parameter instead<p>That one got fixed without a time machine!
corethreeover 1 year ago
The Entire front end web stack looks like a design mistake.<p>Backend looks better only because of the flexibility. You can do anything in the back. But the front you&#x27;re locked into multi decade old tech and the decade old wrappers written around it.
评论 #38373487 未加载
评论 #38364673 未加载
评论 #38364753 未加载
评论 #38365624 未加载
roblhover 1 year ago
More tools to manipulate scroll targeting, scroll bars, and better access to more parameters around scrolling. Also better tools around display: clip. I spent maybe 6 hours trying to recreate instagram on iOS’s appbar scrolling to hide&#x2F;reveal and even with some JavaScript, I don’t think it’s actually possible to coax a browser into doing it perfectly. Particularly to have it be completely smooth without scrolling artifacts, and on mobile.<p>Also, if anybody can figure it out, I would absolutely love to see and discuss.
r2b2over 1 year ago
<p><pre><code> The list-style properties should be called marker-style, and list-item renamed &gt; to marked-block or something. </code></pre> I think list and list-item are clear.<p>How about just `mark` instead of `marker-style` to be consistent with other properties that decorate part of an element like `border` or `background`?
mediumsmartover 1 year ago
Flexbox is obsolete and as with JavaScript you are supposed to wrestle with a subset of css aka the good parts.<p>Sensible user interfaces are a solved problem and it is totally fine that the tutorial industry shows all the other possibilities you have when you don’t need to display content while the framework industry points to general one size fits all solutions from which you can pick the one that fits your specific general use-case and favorite way of displaying the filler text around the advertising content.
评论 #38376119 未加载
评论 #38376273 未加载
oftenwrongover 1 year ago
There are even more fundamental mistakes in the concept of page styling. For example, that a webmaster should attempt to choose a readable font size and font colour on behalf of their users without knowing anything about the users&#x27; needs in that regard.
cantSpellSoberover 1 year ago
&gt;That should be corrected<p>There used to be a PostCSS plugin that <i>did</i> fix some of these, for example you could write &quot;white-space: no-wrap&quot; and it would compile to &quot;nowrap&quot; (which is syntactically correct). I can&#x27;t remember what it was called.
hknmttover 1 year ago
The biggest fuckup of CSS, to this day, is lack of vertical centering of content.
评论 #38376595 未加载