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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Universal.css

289 点作者 jchampem大约 9 年前

48 条评论

mrgreenfur将近 9 年前
Poes law meets css: &quot;Poe&#x27;s law is an Internet adage which states that, without a clear indicator of the author&#x27;s intent, parodies of extreme views will be mistaken by some readers or viewers for sincere expressions of the parodied views.[1][2][3] &quot; <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Poe%27s_law" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Poe%27s_law</a>
评论 #11755605 未加载
评论 #11754457 未加载
hashkb大约 9 年前
This is amazing. I quit a job at a company that did many stupid things, one of which was insist that their home rolled CSS framework did not suck. Said framework was, in all seriousness, exactly this but with shortened, cryptic names. Nightmare.
评论 #11754552 未加载
评论 #11756657 未加载
roddux大约 9 年前
&gt;<i>Bootstrap V4 recently introduced spacing utility classes like m-t-1 (which translates to margin-top: 1rem!important), and we thought we&#x27;d expand this idea to more classes.</i><p>Which is worse; when it&#x27;s done as satire, or seriously?
评论 #11753756 未加载
评论 #11753753 未加载
steego大约 9 年前
Absolutely brilliant! Because of its <i>universal</i> nature and compositional design, one only has to download this CSS page once from the primary CDN and it can be used for everything everywhere. One could even argue this should be a standard browser component.
nachtigall大约 9 年前
You&#x27;d think this is a joke, but have a look at this comment at <a href="https:&#x2F;&#x2F;hacks.mozilla.org&#x2F;2016&#x2F;05&#x2F;css-coding-techniques&#x2F;comment-page-1&#x2F;#comment-19925" rel="nofollow">https:&#x2F;&#x2F;hacks.mozilla.org&#x2F;2016&#x2F;05&#x2F;css-coding-techniques&#x2F;comm...</a><p>&gt; Now that we’re writing almost all of our html in modular fashion, I have found mix-n-matching pre-defined css classes works the best. i.e. class=”inline-block bg-bbb text-333 padding-5-15″
aplummer大约 9 年前
This is great. Something similar was on hacker news without the &quot;of course this is a joke&quot; qualifier:<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=11001820" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=11001820</a>
ojii大约 9 年前
At under 5MB, it&#x27;s quite lightweight compared to other modern tools too, nice!
评论 #11754063 未加载
yAnonymous大约 9 年前
They&#x27;re making fun of Bootstrap, but having classes that allow you to define margins and padding quickly by adding a class is actually really helpful. Of course that shouldn&#x27;t be expanded to every possible property.
评论 #11754589 未加载
smhenderson将近 9 年前
Here&#x27;s my favorite part of the presentation:<p><i>View Raw<p>(Sorry about that, but we can’t show files that are this big right now.)</i>
chrismonsanto大约 9 年前
The effect of the joke is lessened when it is labeled as a joke, doubly so when every comment here copypastes the line saying it&#x27;s a joke.<p>See also the latest reprinting of &quot;A Modest Proposal,&quot; which kindly has &quot;SATIRE -- DO NOT BELIEVE&quot; in large caps on the front and back covers.
评论 #11756314 未加载
usmanshaikh06大约 9 年前
Is this a joke?<p>Of course it&#x27;s a joke. Use semantic CSS class names.
YngwieMalware将近 9 年前
I was almost offended until I realized it was too absurd to be real. Really happy this is a joke, holy crap.
ryannevius大约 9 年前
This reminds me of Tachyons[1], except Tachyons (supposedly) isn&#x27;t satire.<p>[1] <a href="http:&#x2F;&#x2F;tachyons.io&#x2F;" rel="nofollow">http:&#x2F;&#x2F;tachyons.io&#x2F;</a>
评论 #11753158 未加载
评论 #11755141 未加载
blowski大约 9 年前
Funny, but before we all get on our high horses:<p>1. Bootstrap is partly for prototypes and quick interfaces where front end best practices don&#x27;t matter.<p>2. If you&#x27;re using a preprocessor, you can include Bootstrap&#x27;s classes and rename&#x2F;combine them to something semantic.<p>3. Something can be a good idea when done in small quantities, and a terrible idea when taken to extremes.
sunnyshahmca大约 9 年前
I know it is a joke. I have been a contributor to the Webkit project and these kind of jokes really scares me to death.
binthere将近 9 年前
People who don&#x27;t understand the concept of atomic CSS usually joke about it, but has no idea about the benefits. The new Twitter mobile site is fast as hell and use this concept. Semantic class names makes no sense when you think about it.
评论 #11754418 未加载
megalodon大约 9 年前
Delightful, cringe-entailing humour; this definitely made my day.
kevinyun将近 9 年前
If you don&#x27;t read the docs fully, everything looks really official with 314 stars social credibility too
lanestp将近 9 年前
It&#x27;s sad that my first reaction was &quot;Looks like bootstrap.&quot; I would like a few more colors. Maybe you could add pantone support, that would make this super useful esp. for mobile!
Randgalt大约 9 年前
The real joke is how screwed up client side programming is. Here&#x27;s a library that&#x27;s an insider&#x2F;hipster joke but it&#x27;s only obviously a joke to hipster&#x2F;insiders.
评论 #11754355 未加载
leray_J将近 9 年前
I&#x27;m getting scared to see that on front page, I&#x27;m the kind of guy which could have enough luck to randomly fall into a project where someone used it for real.
评论 #11754732 未加载
return0将近 9 年前
This is awesome. I no longer need to type the dreaded &quot;:&quot; , which requires the most awkward finger combination . My ulnar nerve will be so happy.
评论 #11754464 未加载
jjar将近 9 年前
I was about to flip the table before reading the last faq. Good one.
thierryk将近 9 年前
I think we should judge a technique in regard to the problems it solves and the ones it creates, not in regard to our understanding of the said technique.<p>No, it is not the same as using &quot;inline styles&quot; (just think about it). Yes, it reduces CSS scope and bloat in styles sheets. Yes, it breaks the Separation of Concern principle. No, it does not create bloat in the markup. Yes, it forces you to style via markup rather than via a style sheet, etc.<p>Like with any other technique, choosing to use &quot;Atomic CSS&quot; in a project should be considered in relation to the problems authors have to solve. CSS is a complex matter, there is no one size-fit-all solution and there are not that many solutions either so I think we should think twice before disregarding a tool, any tool.<p>PS: Yes, I know universal.css is a joke but it is mocking a real&#x2F;serious approach to big CSS problems.
Loque将近 9 年前
I am really glad someone has put this together - I was enjoying Harry Roberts talk at RenderConf until he dropped this in our faces: <a href="http:&#x2F;&#x2F;csswizardry.com&#x2F;2016&#x2F;05&#x2F;the-importance-of-important&#x2F;" rel="nofollow">http:&#x2F;&#x2F;csswizardry.com&#x2F;2016&#x2F;05&#x2F;the-importance-of-important&#x2F;</a><p>Utility classes I dislike (mixins plx) and the idea of using important with them is not a design decision I would want to pick up.<p>I guess my bigger problem is that Harry sells himself as an expert, stands up on stage telling people this is how they should be doing things... and here I am, no book, no stage and my specificity level gets trumped by Harry amongst certain members of my team (despite my years of qualified awesomeness across large scale, popular, public domain sites)<p>Thought I&#x27;d just share that with you :`P
评论 #11755164 未加载
yuvalkarmi大约 9 年前
this is wonderful! finally, a clear, succinct way of writing CSS. This is what I&#x27;ve been waiting for since I wrote my first &lt;font &#x2F;&gt; tags when I was eight.
评论 #11753955 未加载
kalkin将近 9 年前
I pretty much completely disagree with the implicit critique here. The codebase I work on now has largely transitioned from &quot;semantic&quot; CSS (classnames based on feature) to CSS with classnames that describe what they <i>do</i>, visually, and the latter has made writing frontend code dramatically more straightforward - it&#x27;s gone from something I dread and try to pass off to a specialist to something I can do easily. A night-and-day improvement.<p>I mean, nobody actually advocates translating every single possible style attribute into its own CSS class. But what&#x27;s wrong with padding and margin utility classes that use a consistent set of widths? Is doing calculations on &quot;1x&quot; and &quot;2x&quot; when you want elements to line up really worse than doing calculations on pixel or em values in your CSS just because it&#x27;s &quot;unsemantic&quot;?<p>Let&#x27;s take the examples from the &quot;maintainable CSS&quot; book that&#x27;s linked:<p><pre><code> &lt;!-- bad [sic] --&gt; &lt;div class=&quot;red pull-left&quot;&gt; &lt;div class=&quot;grid row&quot;&gt; &lt;div class=&quot;col-xs-4&quot;&gt; &lt;!-- good [sic] --&gt; &lt;div class=&quot;header&quot;&gt; &lt;div class=&quot;basket&quot;&gt; &lt;div class=&quot;product&quot;&gt; &lt;div class=&quot;searchResults&quot;&gt; </code></pre> Ask yourself, in which case can you read the code and tell roughly how it&#x27;s going to render? In which case do you think you&#x27;ll be able to re-use the classes on other pages? If you wanted to make another, visually consistent page that shows, say, seller search results instead of product ones, in which case do you think you&#x27;ll be able to figure out which styles need to change more quickly?<p>Here&#x27;s the backend equivalent:<p><pre><code> # &quot;bad&quot; def cheapest_products_with_min_rating(rating) products. select { |p| p.rating &gt;= rating }. sort_by { |p| p.price }. first(10) end # &quot;good&quot; def products_for_category_landing_page(rating) allowed = [] for p in products if p.rating &gt;= rating allowed &lt;&lt; p end end # pretend I&#x27;ve implemented quicksort here result = [] for p in sorted break if result.length &gt;= 10 result &lt;&lt; p end result end </code></pre> Ugh, that first example - using all these &quot;unsemantic&quot; components like &quot;sort&quot; and &quot;select&quot;! How do I know when I look at the implementation of any of them, or the function itself, what the intent is? What business problem is being solved?<p>The second example - so nice and &quot;semantic&quot;. If we want to change what products show up on the category landing page, it will be easy!<p>...<p>In real life, nobody writes backend code like that. Why should we tolerate it in the frontend?
评论 #11755085 未加载
rudedogg将近 9 年前
I&#x27;ve been working on an app that relies on parsing CSS styles for like 6 months - full time. This almost gave me a heart attack until I realized it was a joke.
Kmaschta大约 9 年前
See <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=11737510" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=11737510</a>
cfvergara大约 9 年前
Seriously though. What&#x27;s bad about using, say, tachyons and composing several of its pieces inside more meaningful labels like &quot;sidebar&quot; or &quot;header&quot; or whatever? It&#x27;s simpler to grasp, and it WILL wind up as one dictionary per node anyway
mat_jack1将近 9 年前
It&#x27;s really funny because I&#x27;m working on a real project which uses a CSS which is really like universal.css, and we are thinking of going responsive. Luckily at least this is a joke.<p>I sympathize with the other commenters with my same problem.
mendelk将近 9 年前
I know this is meant as a joke, but having used BassCSS[0] in a production webapp, I believe it really is a valid approach to CSS.<p>To each their own, I guess.<p>[0] <a href="http:&#x2F;&#x2F;www.basscss.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.basscss.com&#x2F;</a>
chrispie将近 9 年前
go on and just waste more time on this by reading the comments
drivingmenuts将近 9 年前
Can someone kindly explain how I&#x27;m supposed to feel about this? I&#x27;m on mobile ATM and my feelings are somewhat restrained by available processing power.
nkjoep将近 9 年前
Does this compile with vanillajs?
babby大约 9 年前
I&#x27;ve done this before. The performance on IE, firefox, safari and mobile is complete shit yet suprisingly good in Chrome.
syzygykr大约 9 年前
cornflowerblue was a nice touch.
foota将近 9 年前
(Sorry about that, but we can’t show files that are this big right now.)<p>Uh oh
typedef_struct将近 9 年前
For about 15 seconds I was horrified. Time to go to bed.
cloudjacker将近 9 年前
&gt; Of course it&#x27;s a joke.<p>whew, had me going there
surunzi将近 9 年前
Obviously, it&#x27;s just a joke.
bingeboy将近 9 年前
Sign me up.
mobiuscog大约 9 年前
These frameworks get everywhere.
dikiaap将近 9 年前
Cool
fortytw2大约 9 年前
&gt; Where is the documentation? &gt; You don&#x27;t need documentation.<p>What constitutes self-describing code is wildly different depending on the person. I mean, really?<p>EDIT: I definitely missed that this is a joke :&#x27;(
评论 #11753009 未加载
jstoja大约 9 年前
In the end, why not directly have the JS reading the class and generating only what&#x27;s needed? That would be very cool! I&#x27;m still having some doubts about the maintainability (duplication, isolation...) of such styling btw...
评论 #11753201 未加载
fiatjaf大约 9 年前
People really waste their time on these jokes.<p>I have a lot of ideas for small side projects that could be good (or probably not, but at least I wanna try them seriously) and can&#x27;t get time to implement them, and people who have this time waste it writing universal.css.
评论 #11753462 未加载
评论 #11753497 未加载
smegel大约 9 年前
So I have to choose between a several Meg download vs using JavaScript to render styles?<p>No thanks.<p>Honestly I thought bootstrap was the only css I would ever need, and this hasn&#x27;t changed my mind.