TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Using date-based CSS to make old web pages *look* old (2023)

37 点作者 OuterVale6 个月前

2 条评论

doix6 个月前
Clever use of attribute selectors and the :has selector.<p>Unfortunately as the article talks about, not every website stores the published date in the same way, so you can&#x27;t write a generic CSS rule to add increasing levels of sepia to all sites.<p>Another great use of attribute selectors is to work around mangled CSS names when you&#x27;re injecting your own CSS into other people&#x27;s site.<p>Since so many sites use CSS modules, you&#x27;ll see classnames like &quot;post_s47mgk&quot;. The suffix changing dynamically as they deploy their site randomly.<p>You can do [class^=&quot;post_&quot;] to select that class and it&#x27;ll remain stable even if the mangler changes the suffix.
jamesfinlayson6 个月前
Neat - I thought my CSS knowledge was pretty okay but [attr|=value] was new to me.<p>Incidentally, I remember a guy that I worked with years ago telling me that he&#x27;d worked on a news website (probably in the late 1990s or early 2000s) and had always wanted to do something like this (have the background be a more faded yellow the older the article was).