| title | Incomplete List of Mistakes in the Design of CSS |
|---|
Errors, mistakes and fails that should be corrected if anyone invents a time machine. :P
- css-text: line wrapping behavior should not have been added to
white-space - css-sizing: Percentage heights should be calculated against
fill-availablerather than being undefined in auto situations. - css-text:
word-wrap/overflow-wrapshould not exist. Instead,overflow-wrapshould be a keyword onwhite-space, likenowrap(no-wrap). - css-syntax: Unicode ranges should not have had a separate microsyntax with their own tokenization or token handling. The tokenization hacks required either to make selectors (e.g., u+a) handle things that are unicode-range tokens, or make unicode-range handle the other huge range of tokens (numbers and dimensions with and without scientific notation, identifiers, +) are both horrible.
- css-values: The syntax of unicode ranges should have been consistent with the rest of CSS, like
u0001-u00c8. - css-fonts:
font-familyshould have required the font name to be quoted (like all other values that come from "outside" CSS). The rules for handling unquoted font names make parsingfontstupid, as it requires afont-sizevalue for disambiguation.
- css-syntax: The
@importrule is required to (a) always hit the network unless you specify cache headers, and (b) construct fresh CSSStyleSheet objects for every import, even if they're identical. It should have had more aggressive URL-based deduping and allowed sharing of stylesheet objects. - css-syntax: Comments shouldn't have been allowed basically everywhere in CSS (compare to HTML, which basically only allows them where content goes), because it makes them basically unrepresentable in the object model, which in turn makes building editing directly on top of the object model impossible
- css-syntax: It shouldn't be
!important— that reads to engineers as "not important". We should have picked another way to write this.
- selectors: Selectors have terrible future-proofing. We should have split on top-level commas, and only ignored unknown/invalid segments, not the entire thing.
- selectors: Descendant combinator should have been
>>and indirect sibling combinator should have been++, so there's some logical relationships among the selectors' ASCII art - selectors:
FIXED in the spec, waiting for implementations to check for Web-compat...:emptyshould have been:void, and:emptyshould select items that contain only white space - selectors:
:linkshould have had the:any-linksemantics all along. - selectors, css-pseudo: The pseudo-element
::placeholdershould be::placeholder-textand the pseudo-class:placeholder-shownshould be:placeholder.
- css-box: 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.
- css-box: Partial collapsing of margins instead of weird rules to handle min/max-heights?
- css-tables: Table layout should be sane.
- css-tables: Tables (like other non-blocks, e.g. flex containers) should form pseudo-stacking contexts.
- css-tables:
table-layout: fixed; width: autoshould result in a fill-available table with fixed-layout columns.
- css-text etc.: the
nowrapkeyword value should beno-wrapwith a hyphen - css-animations:
animation-iteration-countshould just have beenanimation-count(likecolumn-count!) - css-inline:
vertical-alignshould not apply to table cells. Instead the alignment properties should have existed in Level 1. - css-inline: The
middlekeyword value of thevertical-alignproperty – or ofdominant-baselinehenceforth – should be calledtext-middleorx-middlebecause it's not really in the middle, and such a name would better describes what it does. - css-position:
z-index² should be calledz-orderordepthand should Just Work on all elements (like it does on flex items). - css-color: The
currentColorkeyword should have retained the dash,current-color, as originally specified. Likewise all other color multi-word keywords for named colors and system colors². - css-borders:
border-radiusshould have beencorner-radius. - css-lists, css-display: The
list-styleproperties should be calledmarker-style, anddisplay: list-itemrenamed tomarked-blockor something. - css-display: The
displayproperty should be calleddisplay-type. - css-compositing (SVG): The
<blend-mode>properties (mix-…,background-…) should've just been*-blend - [css-shape]:
shape-outsideshould have hadwrap-in the name somehow, as people assume the shape should also clip the content as inclip-path. - css-text: The
hyphensproperty should be calledhyphenate. (It's calledhyphensbecause the XSL:FO people objected tohyphenate.) - css-sizing:
sizeshould have been a shorthand forwidthandheightinstead of an@pageproperty with a different definition #11925
- css-color: There should have been a predictable color naming system (like CNS) instead of the arbitrary X11 names which were eventually adopted.
- This could be handled within
color(). - This could be handled by making color keywords overridable.
- This could be handled within
- [css-overflow], css-text: The
text-overflowproperty should always apply, not be dependent onoverflow - css-flexbox: Flexbox should have been less crazy about
flex-basisvswidth/height. Perhaps: ifwidth/heightisauto, useflex-basis; otherwise, stick withwidth/heightas an inflexible size. (This also makes min/max width/height behavior fall out of the generic definition.) - css-flexbox: The
flexshorthand (andflex-shrinkandflex-growlonghands) should acceptfrunits instead of bare numbers to represent flex fractions. - [css-overflow]:
overflow: scrollshould introduce a stacking context - css-grid: We probably should have avoided mixing keywords (
span) with idents in the grid properties #1137, possibly by using functional notation (likespan(2)).
- css-sizing: Box-sizing should be
border-boxby default, i.e. IE4 was righht all along. - css-backgrounds: Not quite a mistake, because it was a reasonable default for the 90s, but it would be more helpful since then if
background-repeatdefaulted tono-repeat. - css-backgrounds:
background-sizewith one value should duplicate its value, not default the second one toauto.- Ditto
translate().
- Ditto
- css-backgrounds:
background-positionandborder-spacing(all 2-axis properties) should take vertical first, to match with the 4-direction properties likemargin. - css-values, css-box: The 4-value shorthands like
marginshould go counter-clockwise (so that theinline-startvalue is before theblock-endandinline-endvalues instead of after them). - css-position: Absolutely-positioned replaced elements should stretch when opposite offset properties (e.g. left+right) are set, instead of being start-aligned.
- css-text:
text-orientationshould have haduprightas the initial value (given the latest changes to 'writing-mode'). - css-flexbox: The alignment properties in Flexbox should have been writing-mode relative, not flex-flow relative, and thus could have reasonably understandable names like
align-inline-*andalign-block-*. - css-inline:
line-height: <percentage>should compute to the equivalentline-height: <number>, so that it effectively inherits as a percentage not a length
- css-color:
rgba()andhsla()should not exist,rgb()andhsl()should have gotten an optional fourth parameter instead (and the alpha value should have used the same format as R, G, and B or S and L).- Arguably, there should have been either just one function per color space (sRGB, CIE Lab, OK Lab, …) or one function per space representative transformation (cartesian, cylindrical, polar, spherical, …).