css css2 css3
Due to the ever-growing popularity of React, Facebook’s user interface library, there has been some discussion on the topic of CSS and whether or not it has a future in its current form — that is, in the form of declarations in a separate stylesheet that provide presentation information for a given page or section of markup.
由于Facebook用户界面库React的日益普及,围绕CSS主题以及它是否具有当前形式的未来(即以单独的样式表中的声明形式)进行了一些讨论。提供标记的给定页面或部分的演示信息。
I’m not going to rehash the conversation or the pros and cons here. For those not familiar, here are a few links you can check out:
我不会在这里重新讨论对话或优缺点。 对于不熟悉的人,这里有一些链接可以查看:
The Debate Around “Do We Even Need CSS Anymore?” by Chris Coyier
关于“我们是否还需要CSS?”的辩论 克里斯·科耶尔(Chris Coyier)
React: CSS in JS slides and video presentation
React:JS幻灯片和视频演示中的 CSS
But what I will do is provide some strong evidence that CSS is alive and well.
但是我要做的是提供一些有力的证据,证明CSS仍然有效。
When I read the reactions and heated debates in comment sections of articles like this one or this one, two things become clear:
当我读到的React和在类似的文章评论部分激烈的辩论这一个或这一个 ,有两两件事很清楚:
Developers are passionate about CSS 开发人员对CSS充满热情 Developers are not happy with some of the proposed solutions for large CSS projects 开发人员对大型CSS项目的一些建议解决方案不满意The two links in the second bullet point in the introduction above are a slide deck and video presentation by Christopher Chedeau, a developer working for Facebook on the React project. This past week was the first time I tried delving into React a little bit, thanks to this great tutorial by Shu Uesegi. After that simple introduction, the slides gave me a little more context.
上面介绍的第二个要点中的两个链接是幻灯片板和Christopher Chedeau的视频演示,Christopher Chedeau是为Facebook从事React项目的开发人员。 上周,由于Shu Uesegi撰写了这篇出色的教程 ,这是我第一次尝试深入研究React。 经过简单的介绍后,幻灯片为我提供了更多背景信息。
Christopher addresses 7 CSS architecture problems that he believes can be solved by using JavaScript to manage and implement styles. This is the kind of thing that makes a lot of purists shudder because, with React, you’re basically writing your markup and styles in your JavaScript — something that’s usually discouraged in keeping with “separation of concerns”.
Christopher提出了7个CSS体系结构问题,他相信可以通过使用JavaScript来管理和实现样式来解决。 这种事情使许多纯粹主义者感到不安,因为使用React,您基本上是在JavaScript中编写标记和样式的-通常不鼓励与“关注点分离”相提并论。
The screenshot below captures one of Christopher’s pertinent slides in this regard, outlining the 7 problems that React attempts to address:
下面的屏幕截图捕获了Christopher在这方面的相关幻灯片之一,概述了React试图解决的7个问题:
Christopher makes a great case for solving CSS’s problems in JavaScript, so I highly recommend you keep an open mind and check out his slide deck (although I’ll forgive him for saying that w3schools is his favorite website for learning JavaScript!).
Christopher为解决JavaScript中CSS的问题提供了一个很好的案例,因此我强烈建议您保持开放的态度并检查他的幻灯片(尽管我会原谅他说w3schools是他最喜欢学习JavaScript的网站!)。
So it’s clear that it feels like a CSS revolution is needed and some might say it’s already under way. But it’s also clear that CSS in its current form is not going away anytime soon.
因此很明显,这似乎需要CSS革命,并且有人可能会说它已经在进行中。 但是很明显,当前形式CSS不会很快消失。
If you were keeping tabs on your RSS feeds and Twitter stream in the past week or so, then you probably came across my most recent CSS article. That was one of the most enjoyable articles to write, and judging by the incredible response in the comments and on social media, I’m glad to see that it was as enjoyable for readers.
如果您在过去一周左右的时间里都在RSS提要和Twitter流上保持标签,那么您可能会看到我最近CSS文章 。 那是写的最有趣的文章之一,从评论和社交媒体上令人难以置信的回应来看,我很高兴看到它对读者同样有趣。
The popularity of those types of articles demonstrates that developers still love CSS in its traditional form. Tweets by Ilya Grigorik, Smashing Magazine, CSS-Tricks, and others were shared and favorited hundreds of times. And the traffic to that article and its predecessor has been amazing.
这些类型文章的受欢迎程度表明,开发人员仍然喜欢传统形式CSS。 Ilya Grigorik的推文, Smashing Magazine , CSS-Tricks和其他内容被数百次共享和收藏。 这篇文章及其前身的访问量惊人。
The content in my articles is mostly covering stuff that’s been available in browsers for years, not just the new “CSS3” features. In fact, I intentionally tried to use as many cross-browser CSS tips as possible and the response has been overwhelming.
我的文章中的内容主要涵盖了多年来在浏览器中可用的内容,而不仅仅是新的“ CSS3”功能。 实际上,我有意尝试使用尽可能多的跨浏览器CSS技巧,并且React令人over目。
But this sort of thing is not unique to my article. Consider past CSS articles on other sites that have been hot in the community. Two that immediately come to mind are, not coincidentally, both by Heydon Pickering:
但是这种事情并非我的文章所独有。 考虑一下社区中其他热门网站上过去CSS文章。 海因·皮克林(Heydon Pickering)并非偶然地想到了两个立即想到的问题:
Tetris and the Power of CSS
俄罗斯方块和CSS的力量
Quantity Queries for CSS
CSS的数量查询
Readers eat that stuff up! CSS developers of all levels, and even back-end developers, are sure to enjoy that kind of content. It has a special appeal because it’s unique and it demonstrates that there is always something new to learn in CSS. I don’t know what the traffic numbers for those articles were, but I’m sure they were very high in comparison to other articles on the same sites around the same time.
读者把东西吃光了! 所有级别CSS开发人员,甚至是后端开发人员,都一定会喜欢这种内容。 它具有独特的吸引力,因为它很独特,并且表明在CSS中总是有新的东西要学习。 我不知道这些文章的访问量是多少,但是我敢肯定,与同一时间在同一站点上的其他文章相比,它们的访问量很高。
Last month, Lea Verou, known throughout the industry for her CSS secrets conference presentations (first and second) has written a book for O’Reilly based on her popular “secrets” premise.
上个月,以其CSS秘密会议演示文稿( 第一和第二篇 )而闻名于业界的Lea Verou根据她流行的“秘密”前提为O'Reilly编写了一本书 。
Her “secrets” presentations have been a few of the most shared and popular presentations from the conference circuit over the past 5 years. No wonder she’s used that premise to spawn a book project.
在过去的5年中,她的“秘密”演讲是会议回路中最共享和最受欢迎的演讲之一。 难怪她会以此为前提来生成图书项目。
As of this writing, Lea’s book is ranked in the top 3,000 books overall on Amazon (that’s all books included, not limited to web development) and it’s in the top two or three in a number of different developer-specific Amazon categories.
在撰写本文时,Lea的书在亚马逊整体3,000本书中排名最高(包括所有书籍,不仅限于Web开发),在不同的特定于开发人员的Amazon类别中它也排名前二或三。
Again, this demonstrates that CSS in its current form is still in high demand and is not going away soon.
同样,这表明当前形式CSS仍然有很高的需求,并且不会很快消失。
Similarly, here at SitePoint, we’re still pumping out lots of CSS content in the form of books and courses on SitePoint Premium (formerly Learnable). Some of the most popular titles available on SitePoint Premium are the CSS-based content. And there’s more CSS content in the works. So the demand is not slowing down.
同样,在SitePoint上,我们仍以SitePoint Premium (以前为可学习) 上的书籍和课程的形式提供大量CSS内容。 SitePoint Premium上一些最受欢迎的标题是基于CSS的内容。 作品中还有更多CSS内容 。 因此需求并没有放缓。
As Chris Coyier pointed out in his post (linked above in the intro):
正如克里斯·科耶尔(Chris Coyier)在他的帖子中所指出的(上面的介绍中链接):
Nobody is saying we don’t need styles. We still need to style things, what’s being talked about is how and where we do that.
没有人说我们不需要样式。 我们仍然需要对样式进行样式设置,所讨论的是如何以及在何处进行样式设置。
This means that even if the industry caught on with stuff like React and we began generating our markup and styles in our JavaScript, we’re still going to need to study CSS, learn new tricks, and uncover shiny new little-known facts. We’ll just be managing them in our JavaScript instead of in separate stylesheets. A poll that Chris is currently running on CSS-Tricks also indicates that most developers don’t like what React brings to the table in terms of CSS.
这意味着,即使该行业赶上了React之类的东西,并且我们开始在JavaScript中生成标记和样式,我们仍然需要学习CSS,学习新技巧,并发现鲜为人知的崭新事实。 我们将仅在JavaScript中而不是在单独的样式表中对其进行管理。 克里斯目前正在CSS-Tricks上进行的一项民意调查还表明,大多数开发人员都不喜欢React就CSS所带来的影响。
And it should also be noted that there’s a lot of important stuff that React doesn’t handle well. So we have a long way to go before we hang up our .css files and move everything into our scripts.
还应注意,React无法很好地处理很多重要的东西 。 因此,在挂起.css文件并将所有内容移入脚本之前,还有很长的路要走。
Part of the popularity of CSS is the fact that it’s easy to learn but hard to master. When CSS becomes intermingled with JavaScript, the “easy to learn” part starts to disappear. For that reason alone, I think we’ll always have traditional stylesheets. But some front-end engineers might simply choose to use more advanced options to deal with the challenges that Christopher Chedeau attempts to tackle in his slides.
CSS普及的部分原因是它易于学习但很难掌握。 当CSS与JavaScript混合在一起时,“易学”部分开始消失。 仅出于这个原因,我认为我们将始终拥有传统的样式表。 但是一些前端工程师可能只是选择使用更高级的选项来应对Christopher Chedeau试图在幻灯片中解决的挑战。
That’s my current and probably somewhat ignorant view, based on some of the things I’ve been observing over the past week. What do you think? Can traditional CSS coexist with React-like implementations? Or is React’s current model just a fad that will likely evolve to something more in line with what we’re used to? Let me know your thoughts.
根据我在过去一周中观察到的一些事情,这是我目前的观点,并且可能有些无知。 你怎么看? 传统CSS可以与类似React的实现共存吗? 还是React的当前模型只是一时的流行,可能会演变成与我们过去所习惯的更相符的东西? 让我知道你的想法。
翻译自: https://www.sitepoint.com/css-is-alive-and-well/
css css2 css3
相关资源:HTML5+CSS3 精美登陆界面源码