CSS in the Modern World
Together in one definition all the specs that form the current state of Cascading Style Sheets (CSS) as of 2015.
Join the DZone community and get the full member experience.Join For Free
the w3c recently announced a cascading style sheets (css) snapshot – a document that “collects together into one definition all the specs that together form the current state of cascading style sheets (css) as of 2015. the primary audience is css implementers, not css authors, as this definition includes modules by specification stability, not web browser adoption rate.” this motivated me to consider the relevance of css in today’s modern web developer community, and how best to implement today.
because so much has changed over the years, i thought it would be appropriate to do a developer based ‘snapshot’ of where css is now, and how to embrace the future. my personal experience was not enough to satisfy an answer, so i did much research and interviewed industry experts on their point of view. with all the data i acquired, i knew i had enough findings to support writing a book! i decided writing series of online articles on css would be much quicker to market, so i am proud to introduce this first post of the mastering css series .
is css relevant today?
as the opening words of this article clearly show, there is momentum in the field of css. the major browsers out there are still working hard to implement css features, and the passionate developer community is working hard to continue making great websites with css. think of the innumerable blogging sties using wordpress which of course uses css to complement theming . with a strong foundation and active community, css is very relevant today.
what about the valid arguments against css? while i will not be addressing them here, i am happy to see the ‘uproar’ and some turning toward alternatives. why? because it is healthy for the community to challenge how things are done so that there is opportunity for improvement. it is my humble opinion that the css of the future will be molded by the very complaints against it today.
simple css truths
in our modern world, i find it is good to pause and question why we are doing what we do. in the spirit of questioning my personal continued use of css, i wanted to come up with evidence of why i should still care to do so. below is a list of statements i concluded (with the help of others) that add weight to why css continues to be my dominate choice for styling with web technologies:
- css allows for separation of concerns . css is a complementary language to html, enabling style definitions to be maintained separately from the markup. cleaner markup is easier to read and maintain, and is typically easier to crawl by search.
- css is responsive. css enables the best viewing of content based on viewing dimensions or how it should be rendered if printed, to name just a couple of examples.
- css has a captive audience . there is no shortage of books, videos, articles, and websites centering on css. and there is a growing list of libraries/tools/frameworks dedicated to make css implementation easier and more efficient.
- css is everywhere. modern browsers embrace css, and a list of features supported by each is maintained at sites such as caniuse.com (see comment below). css is also used to style mobile apps found across multiple platforms when packaged using services like manifoldjs or cordova .
regarding the status of css across browsers, a more accurate gauge for determining what features are currently supported or in development can be obtained by consulting directly with each specific vendor. for example, check out the platform status section at dev.modern.ie for the css roadmap regarding microsoft edge .
using css today
there are multiple ways to implement css today. there is no single method that is perfect for all scenarios, since different projects will have varying needs and constraints. questions that would contribute toward determining an approach include: what features of css does the project require? what browsers/platforms does my project need to support? how many developers will be contributing to project, and what are their skill levels? are the fastest response times a high priority?
after considering the questions above, it is now time to look at what approaches are out there. the combination of possibilities is high, so i will break it down to these two general terms:
- manual implementation and maintenance of css . simply put, the developer is responsible for all aspects of css.
- css with the help of extensions/frameworks . developer depends on an extension or framework to help write efficient css and/or to publish a minified file. the types of extensions/frameworks are varied, and many of them have dependencies on one or more of the others.
while the second approach is clearly trending in adoption, it doesn’t mean it is always the answer. for example, a small intranet site with a predictable audience in terms of browsers/devices might appear over-engineered to implement multiple css frameworks – especially if the site had a small number of pages. would minifying files be critical in such a scenario? would it take more time for developers to set up the frameworks and learn them than to just write the site? a manual implementation of a single css page may be all that is needed.
the reality is many sites will be a lesser or stronger degree of the second approach. for example, a developer savvy with css may have excellent skills but relies on tooling for minifying files. another example is using a full framework like bootstrap , and purchasing themes to quickly get a site up and running. another example may be the use of w3.css for simple responsive styling. to the degree any dependency will help (not hurt) the overall project, it should be strongly considered for use.
css has a history, an active presence, and a continued future in web development. while there are challenges to implementing css, there are also many reasons why it continued to be the reigning technology for styling the web. this article focused on the role of css in our modern world. upcoming articles in the mastering css series will cover best practices, top tips, and a deeper look into extensions and frameworks!
Published at DZone with permission of Michael Palermo, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.