News for hackers. Stuff that matters.
Re:Imagining CSS for URLs and HTTP Headers by TheRealPomax on Monday November 28, 2022 @11:33AM (#33775706)
> there can be information critical to styling a webpage that lives outside of the HTML alone

There... shouldn't be? I'm kind of missing the part that explains why you'd need this? Are there any concrete examples where "I need the headers and/or URL" lets you do something that you can't already do by making sure your document has the information it needs, in the document itself? (if you need URL-specific CSS, you just... load more CSS...? You template in the necessary <link> elements because your server knows which URL is being requested?)

Re:Imagining CSS for URLs and HTTP Headers by theandrewbailey on Monday November 28, 2022 @01:13PM (#33777207)
Agreed. I don't understand why CSS should know the page's URL. Today, one can use a bit of JS to figure out the page's URL, and use it to add a class to <html> or <body>.
Re:Imagining CSS for URLs and HTTP Headers by deathanatos on Monday November 28, 2022 @01:16PM (#33777258)
It seems like the "FART" problem is sort-of driving it, but the second URL contains a rough solution to it that doesn't require the (IMO crazy) idea in the main article.

I think the second linked article required an "edge function" to add the data- attribute to the HTML delivered to the client, and I think TFA's author doesn't like the need for that (i.e., wants to deliver a static document), but I think you could do it with some synchronous Javascript; the fallback for clients not wanting JS would be CSS media queries that just obeyed the UA's preferences… which seems like exactly what one should want…?

(So, I'm also missing a convincing "why", here.)

Re:Imagining CSS for URLs and HTTP Headers by justinator on Monday November 28, 2022 @01:26PM (#33777432)
I'm kind of missing the part that explains why you'd need this?

I don't think it completely solves it, but it would be useful to be able to apply styling to a specific part of the page ie: highlight something so when you send it, it saves the receiver a little time searching for it.

Or in a similar vein, wouldn't it be cool to make any header an anchor? So I could say,

http://example.com/article.html#second_header

or whatever. Not the same concept, but it would be useful.

Re:Imagining CSS for URLs and HTTP Headers by slondr on Monday November 28, 2022 @06:46PM (#33781593)
There's really nothing stopping a UA from doing this, and in bygone eras "document trees" used to be part of browser UIs.

Gemini clients still keep that dream alive, although there's plenty of disagreement as to exactly how it should function: https://gitlab.com/gemini-specification/gemini-text/-/issues...

Re:Imagining CSS for URLs and HTTP Headers by hayyyyydos on Tuesday November 29, 2022 @06:47AM (#33786361)
> Or in a similar vein, wouldn't it be cool to make any header an anchor? So I could say,

You already can make any header an anchor, right?

eg: <h2 id="second_header">Second Header</h2>

Re:Imagining CSS for URLs and HTTP Headers by cryptonector on Tuesday November 29, 2022 @12:46AM (#33784109)
Also, letting the page see all of the response is a bad idea, security-wise.