Writ – Opinionated, classless styles for semantic HTML
cmcenroe.me
cmcenroe.me
In my opinion, the reason that web technology sucks is that the standards are being created for novices instead of for developers. If the web was a place for developers, we would have seen multiple competing replacements for CSS years ago.
Creating something for novices (or humans, as I like to call them) is the noble thing to do. Maybe the standards committee missed the target somewhat, but their goal was to empower anyone to participate in the web.
I'm getting a bit sidetracked now, but I highly recommend watching this fantastic talk by Bret Victor; it has really changed the way I think about the work I do: https://vimeo.com/115154289
No, the noble thing to do for a committee is to acknowledge that you (as a committee, no matter how large) don't know what is best for all people, and that there are intelligent people out there (i.e., not part of the committee) who might have more insight than you do.
EDIT: Rephrased this a little because from the comments it seems this was misunderstood.
[1]: https://lists.w3.org/Archives/Public/www-style/ [2]: https://lists.w3.org/Archives/Public/public-webapps/ [3]: https://whatwg.org/mailing-list#specs
This is true, but misleading.
It's true that it costs nothing to join a W3C mailing list. However, if you join such a list and actually try to participate, you rapidly discover that:
1) Making a meaningful contribution requires being able to commit enough time to shepherd that contribution through the twin gauntlets of W3C process and internal committee politics;
2) The only people who can justify committing that kind of time are people for whom doing so is their full-time job;
3) Almost all of the people whose full-time job is participating in a W3C list are browser implementers;
4) Browser implementers, unsurprisingly, tend to see the problems and concerns of browser implementers as being inherently more important than the problems and concerns of other types of stakeholders in the Web (e.g. Web developers, marketers/adtech people, privacy advocates, accessibility advocates, etc.).
You generally discover this the first time you have the temerity to offer an opinion, at which point you are bombarded with responses about how you don't really understand the issue because you're not a browser implementer and have no idea how hard it is to be a browser implementer because browser implementers have it harder than anybody else in the world including lepers and orphans and seriously you have no freaking idea how anything in the world even works and bro do you even implement we didn't think so thanks for your useless opinion now go away.
(Full disclosure: I may still be a little bitter from my participation in the HTML5 process.)
You mean like this?
:matches(A B) {
color: blue;
}
http://www.w3.org/TR/selectors4/#matchesOur tools have gotten good enough to allow us to imagine many permutations of a hypothetical future-browser, and the best ideas coming from these experimental technologies are being embraced by companies like Facebook and Google, who represent an obvious power-player in terms of spec influence.
In particular the recent trend of eliminating all the global scope/cascade issues (most notably via "CSS in JS" from the React community) is a good sign that our technology is evolving -- not merely mutating.
ul li { list-style-type: disc; }
ul li li { list-style-type: circle; }
ul li li li { list-style-type: square; }
ol li { list-style-type: decimal; }
ol li li { list-style-type: lower-roman; }
ol li li li { list-style-type: lower-alpha; }
These are bad. Very bad. Example: <ul><li><ol><li> uses unordered styling on the ordered inner list.A little better:
ul > li { list-style-type: disc; }
ul ul > li { list-style-type: circle; }
ul ul ul > li { list-style-type: square; }
ol > li { list-style-type: decimal; }
ol ol > li { list-style-type: lower-roman; }
ol ol ol > li { list-style-type: lower-alpha; }But it breaks the font sizing. Also it would be cool if H1 would be smaller inside an ARTICLE than H1 outside of an article like the default setting in Safari etc.
Would be good if useful defaults wouldn't be destroyed by too general css.
It uses these 12 IDs:
css-zen-garden, design-archives, design-selection, zen-benefits, zen-explanation, zen-intro, zen-participation, zen-preamble, zen-requirements, zen-resources, zen-summary, zen-supporting
And these 39 classes:
archives, benefits, css-resources, design-archives, design-name, design-selection, designer-name, explanation, extra1, extra2, extra3, extra4, extra5, extra6, indicator, intro, main, next, page-wrapper, participation, preamble, requirements, resources, select, sidebar, summary, supporting, view-css, viewall, wrapper, zen-accessibility, zen-faq, zen-github, zen-license, zen-resources, zen-submit, zen-translations, zen-validate-css, zen-validate-html
If you've ever wondered how some websites end up with a meg of CSS, that's exactly how that happens. Each view/page starts with some markup, then you sprinkle some one-off CSS hooks over it, and then you write some overly specific CSS rules which are impossible to reuse. Rinse and repeat.
It's more efficient to create a library of reusable building blocks and then build your views/pages out of these. All of the more organized approaches (BEM, SUIT, etc) work this way. You always use what's already there and you only extend a component or create a new one if it's absolutely necessary.
But I always feel bad with all the CSS classes in my markup.
Back in the days I often had only <10 CSS classes and created my styles relative to that. I had the hope that those 10 classes would vanish with HTML5 and its special div-tags.
But now I'm running around throwing bootstrap classes around like there is no tomorrow.
We used to spend hours applying those 8 stylesheets to our pages and deciding which one we preferred... Really edgy types used two, or perhaps even three, different styles on their handwoven Web Pages.
Why cannot unstyled document be nice by default?
Run this on some websites and you'll see some things moving around:
document.head.insertAdjacentHTML('afterbegin', '<link rel="stylesheet" href="https://cmcenroe.me/writ/writ.min.css">')- for container size I use % or PX
- for margins, spacing, and padding I use EM or PX
- for text sizes I use PT or %
Here's a short, good primer for typography on the web: http://www.markboulton.co.uk/journal/five-simple-steps-to-be...
Edit: Ok, so I'm not a web developer, so I read after it: http://www.w3.org/Style/Examples/007/units.en.html
Turns out I'm wrong about that 1px is required to be 1 device pixel. But the 3/4 rule is not universal and only applies to print. I don't know how different implementations handle this.
CSS pixels are a measure of your viewing angle, the physical measurement of the device, and your screen's pixel density. Basically 15px should look like 15px should look like 15px, no matter what you're looking at, but because the actual pixel densities of screens differ it can be really weird to think about.
You may need a 30px icon to display 15px wide on a retina screen, even though it sounds like a 15px image should be 100% large (and therefore crisp) at 15px in CSS.
In general, CSS 'PX' is great for spacing inside and outside containers. I often use 5px or 15px padding in places that don't directly touch or contain text. Where text is involved I like to define my spacing in 'em' units because those are relative to the 'font-size', so if I change the font size the spacing will still look great!
Bootstrap (and various other similar systems) lets you specify this, by adding a class of .initialism to the <abbr>
It however pains me how this is heralded as something new by HN. "Finally, someone figured out how to do CSS correctly!" ... Shows how most people have no idea how to work with CSS yet comment on it. CSS Resets and Normalize stylesheets have been used for decades.
Edit: I feel like I should add this I'm not bashing this project. I recognize the quality of it.
Perhaps there are some things that could be incorporated from Normalize, which documents the subtle (and not so subtle) differences in how browsers handle certain elements: https://github.com/necolas/normalize.css
I don't know how I would call Writ. "Baseline" perhaps? Something like that.
What is a beneficial stylesheet system, according to me, is a system that can scale and gives you the opportunity to create a complicated website. This unfortunately doesn't. Sorry.
font-feature-settings: “smcp”;
on an element turns lowercase letters into small-caps; font-feature-settings: “c2sc”;
turns uppercase letters into small-caps.More at https://drafts.csswg.org/css-fonts/#font-variant-caps-prop.
Safari’s renderring engine WebKit just got font-feature-settings: support: https://twitter.com/webkit/status/631827777319256064.
html{box-sizing:border-box} *,:after,:before{box-sizing:inherit}
Because the default content-box is a pain in the ass to work with, so to be able to use border-box all the time is a good thing: http://www.paulirish.com/2012/box-sizing-border-box-ftw/.
And personally I love the other box-sizing :)