4 ms·
The thing is, we cannot think of CSS being just for the browser anymore. More and more stuff are being typesetted or presented/designed using CSS: mobile and de
by p4bl0 3y ago
The thing is, we cannot think of CSS being just for the browser anymore. More and more stuff are being typesetted or presented/designed using CSS: mobile and desktop applications UI, graphic design (the SVG vector format standard uses CSS), as well as all sorts of printed materials. Whether this is a good idea or not is another question, but it's a fact. So CSS kind of has to offer fine-tuned control over many things including tiny details.
See for example Paged.js [1], a way to use HTML and CSS to produce printed books, with complete control over the rendering and an attention to details almost of TeX level's. Using web technologies as source format tremendously facilitates the production of various electronic formats in addition to the printed/PDF version, such as ePub and well, web pages, which need free flow text that print-oriented format do not allow for obvious reasons.
All this to say, I agree with your feeling if we stick to web browsers, but CSS is so much more nowadays.
[1] https://pagedjs.org/ https://pagedjs.org/
- chrismorgan 3y agoCSS specs are explicitly not interested in prescribing TeX-level control; text-wrap-style is a good example of this: it’s just hints, with the actual algorithms completely UA-defined. And in fact, they’re going out of their way to recommend including multiple distinct heuristics of prettiness, so that developers don’t use it as a proxy for just one thing and start relying on something that is explicitly and deliberately undefined. <https://github.com/w3ctag/design-reviews/issues/864#issuecomment-1655290020 https://github.com/w3ctag/design-reviews/issues/864#issuecom...> (And Chromium has done just this: <https://bugs.chromium.org/p/chromium/issues/detail?id=1432798#c54 https://bugs.chromium.org/p/chromium/issues/detail?id=143279...>.) In other words: you’ve already lost!
- p4bl0 3y agoI understand this, but let's be more concrete: when you use CSS to design for print (that is, in general, to produce a PDF), you are using a specific implementation (e.g., Firefox will be used to produce the final PDF from your HTML and CSS, or Inkscape will be from your SVG and CSS). Given an implementation, you get a determined rendering, and it is this specific one that you need to be able to tweak to your needs. Same goes for application UI design: a given GUI framework comes with its own implementation of CSS rendering and it is its specific output that developers (or rather, theme designers) need to be able to have precise control over. In both cases, even if the standard does not precisely states what property values must give what rendering, you get something using the tools you have and you may want to tweak details to your taste using those same tools (even if only by trial and "error", but for that you need the option to fine tune the properties you want to play with). Again, I'm not saying CSS is coherent nor that this is a good thing in the absolute sense, as I already said, I agree with your feeling, I'm just saying that I understand where the need of more precise control/tweaking over details that is sometime in the standard comes from.
- chrismorgan 3y agoYou’re abusing CSS. (Can’t say I never have…)
- p4bl0 3y agoWell I'm not, but some people are, probably. The need exists. That's my whole point :).
- jjgreen 3y agoHTML tables for layout FTW.
- gazook89 3y agoOne example that I contribute to: https://homebrewery.naturalcrit.com https://homebrewery.naturalcrit.com It is a code mirror app that outputs md styled like dnd books. It’s very much a “round peg in square hole” project, using html/css to create print materials, but for many it is good enough. It is just html and css, and allows customization, and precise styling requires precise css properties. As you noted, it does only work well in one browser, Chrome on desktop (even though I think all the devs use FF as their daily driver). But as another commenter noted, the answer is that you design on one machine and share via pdf.
- eropple 3y agoThis is ridiculously well-done. Thanks for sharing.
- DemocracyFTW2 3y ago> You’re abusing CSS. In the spirit of "not a bug but a feature" I'd say they use is demonstrating the "full potential" of CSS...
- postmodest 3y agoPart of the perversion is that web standards demand "more than one implementation" (see WebSQL) so if we did the same thing and just "put TeX in the layout pipeline" that would get punted faster than SQLite was. Text layouts being undefined is the last great tragedy of HTML, and we should fix it.
- fvdessen 3y agoI once implemented a knuth style renderer to properly typeset books into html. IMHO If you want to do advanced typography you need to algorithmically set the width and offsets of spans and use spacer elements. Otherwise all that complexity has to go into the css spec and that will be a lot for what is otherwise a niche use-case. Another problem is that good typography is algorithmically expensive and is best computed ahead of time, rather than on page load.
- SigmundurM 3y agoElectronic books (EPUBs) are literally just HTML, CSS (plus some more standards specific to EPUBs).
- chrisfinazzo 3y agoOh, tadpole... I was once like you, thinking like "It's the web! I know this!" Turns out, no...actually you don't. I've been soaking in this for a couple weeks, trying to rid my life of the last few Word documents that I use frequently and haven't converted. Writing HTML to mimic print layout is a bit creaky, but it's trivial compared to the kinds of shenanigans that EPUB often requires. Despite what you might tell yourself, reader applications are not web browsers, and come with their own set of idiosyncrasies and corner cases, and will gladly barf all over your HTML or (worse) sit still and refuse to move no matter how much you cajole them. https://getyarn.io/yarn-clip/34d4f471-2bf6-4e55-ba95-1419f2028696 https://getyarn.io/yarn-clip/34d4f471-2bf6-4e55-ba95-1419f20... If web standards sometimes make you feel like ants trying to reach the top of a hill with bits of grain, EPUB might as well be rolling Sisyphus' boulder. "It is not the web, it's the web as rendered by a schizophrenic, half crazed hamster in a wheel" -John Siracusa
- neves 3y agoWell, Kindle books are formatted with CSS
- Vt71fcAqt7 3y ago+1 for padgedjs. I wish browsers would just implement @page on their own though.