background preloader

CSS

Facebook Twitter

CSS3 pseudo classes and :nth-child ranges. Sass - Syntactically Awesome Stylesheets. Stylus. Simply require the module, and call render() with the given string of Stylus code, and (optional) options object.

Stylus

Frameworks utilizing Stylus should pass the filename option to provide better error reporting. We can also do the same thing in a more progressive manner: CSS3 regions: Rich page layout with HTML and CSS3. The web has become a rich repository of content for reference and educational materials, news, articles, and interactive apps.

CSS3 regions: Rich page layout with HTML and CSS3

However, some of the capabilities that are taken for granted when designing content for print are still impossible or very difficult to implement using web standards. Print publications are exploring better ways of translating and adapting their content to a rich digital format. We see this as an opportunity to make the web more expressive and to support more sophisticated layouts. Adobe has been experimenting with some improvements to CSS to express the kind of complex layouts used by traditional magazines. We have submitted some proposals to the W3C CSS Working Group, and last year built a prototype implementation of these proposals using WebKit. Adapt.js - Adaptive CSS. Adapt.js is a lightweight (842 bytes minified) JavaScript file that determines which CSS file to load before the browser renders a page.

Adapt.js - Adaptive CSS

If the browser tilts or resizes, Adapt.js simply checks its width, and serves only the CSS that is needed, when it is needed. A potential drawback of Adapt.js is the possibility of a brief flash of unstyled content as a new stylesheet is being fetched (think of it as “Ajax” for CSS). I have done my best to mitigate this by keeping CSS files small (3 KB). CSS Sprites Workflow. When you are coding up a brand new site, I think this is a pretty efficient workflow for how to handle CSS Sprites.

CSS Sprites Workflow

Now if you find yourself needing to update the images inside the sprite, the process can be: Update individual images.Comment out Sprited CSS background images and uncomment regular background imagesRemake sprite with SpriteMe, replaceSwap comments again One of the complaints of working with sprites is that it makes updating images harder. Efficiently Rendering CSS. I admittedly don't think about this idea very often... how efficient is the CSS that we write, in terms of how quickly the browser can render it?

Efficiently Rendering CSS

This is definitely something that browser vendors care about (the faster pages load the happier people are using their products). Mozilla has an article about best practices. Google is also always on a crusade to make the web faster. They also have an article about it. Let's cover some of the big ideas they present, and then discuss the practicalities of it all. Right to Left One of the important things to understand about how browsers read your CSS selectors, is that they read them from right to left. ID's are the most efficient, Universal are the least There are four kinds of key selectors: ID, class, tag, and universal. #main-navigation { } body.home #page-wrap { } .main-navigation { } ul li a.current { } ul li a { } * { } #content [title='home'] #main-nav > li { } Even though that feels weirdly counter-intuitive...

Don't tag-qualify. Minify CSS - Compress CSS Code. CSS Mask-Image & Text. I recently wrote about Controlling Web Typography and focused on CSS pseudo selectors & down-to-the-letter control.

CSS Mask-Image & Text

As a web designer, I want the same level of control over type that print designers have, including texture. There are currently 2 webkit CSS properties that I’ve grown to love and hope gain more traction & browser support. My favorite would have to be background-clip:text, but it currently degrades poorly. A close second is mask-image, which you can apply to text. In the example below I’ve implemented a subtle grey flecked texture effect over the white text. Dinero Is not spanish for dinner Here’s the CSS code with all the structural bits trimmed out: In most cases, I prefer subtle amounts of texture / graphic applied to text. As you use and join the chorus to get CSS3 properties more widely accepted, don’t forget about background-clip:text and mask-image.

CSS Tutorials. CSS3 Transition Property. CSS3 Has brought with it many new and interesting properties, one of my favorites has to be the transition property.

CSS3 Transition Property

To put it very simply the transition property gives a webmaster the power to change the transitional speed of and element from one style to another. An example of an element changing from one style to another would be a hyperlink which changes colour when a user hovers his or her pointer over the link. Obviously this is a very simple example but you get the idea. Now imagine that you could slow down this change and thereby create an effect where the first colour merges into the second colour.

Take a look at the link below, hover your mouse over it, this is totally CSS. Example Link Pretty cool hey, I should mention that you need to be using an up to date browser to see these effect. And here is the CSS code, notice the transition properties. Okay, so you get the idea. El Servicio de Validación de CSS del W3C.

CSS Fonts