Archive for the 'CSS' Category

Hello subpixel world

Feb 6th, 2014

Since IE9 and Firefox(v.?) we now have subpixel rendering of fonts. This is cool and all but imagine this: you have some text you want to measure the width of the text and size another element to the same dimensions Simple. But if you use offsetWidth/offsetHeight to measure, you get a rounded integer and not […]

 

Borrowing typography tricks from the masters

Sep 16th, 2013

Inspect the styles in Mobile Safari’s Reader feature to learn typography

 

CSS animations off the UI thread

Mar 12th, 2013

This excellent Google I/O talk mentions that Chrome for Android moves the CSS animations off of the UI thread, which is, of course, a great idea. Playing around with it, here’s what I found: Browser support: Desktop Safari, iOS Safari, Android Chrome. You need to use CSS transforms. Animating regular properties doesn’t work. Update: (see […]

 

webkit css-on-demand issues

Feb 11th, 2013

This post brought to you via Facebook engineers Jeff Morrison and Andrey Sukhachev, who discovered and helped isolate the issue. Use case Think a “single page app” use case. You click a button. Content comes via XHR. But content is complex (and app is as lazy-loading as possible) and content requires extra CSS. In an […]

 

<style> tag to inline style=”" attrrib

Jun 21st, 2012

As you may have noticed, I claim that CSS is bad for performance because: Most browsers block the very first paint until all screen CSS arrives Additionally many browsers block rendering until all non-screen (e.g.print) CSS arrives Sometimes CSS blocks downloads See “The evil that CSS do” in CSS and the critical path for details. […]

 

CSS variables

Jun 14th, 2012

Weeee, CSS variables just landed in WebKit, this is pretty exciting! Unfortunately I couldn’t see them in action in WebKit nightly (must be something I’m missing), but they’re here and here to stay. I know there are “purists” that say that stuff like variables has no place in the language and we don’t really understand […]

 

CSS and the critical path

Jun 5th, 2012

Back when I was still actively into speaking at public events (way, way back, something like year and a half ago (which strangely roughly coincides with the time I joined Facebook, hmmm (hmm? (huh? what’s with the parentheses? sure all of them are closed at this point?)))) I remember showing this slide: The reason I’m […]

 

5 years later: print CSS still sucks

Apr 25th, 2012

This tweet had me revise a 5 year old experiment on how print CSS affects page loading, especially in the light of mobile browsers. So I tweaked the test ever so slightly to print out timing info in the document.title and after the page is done. The test is essentially how does a slow print […]

 

A rounded corner

Apr 13th, 2011

Warning: not practical blog post, don’t read, move on. So this is a post about a thought I had – creating rounded corners in IE678 by using roundness that they already have built-in, meaning the character O. But first: My opinion is that browsers that don’t support border-radius should never ever get rounded corners. Let […]

 

When is a stylesheet really loaded?

Mar 17th, 2011

Often we want to load a CSS file on-demand by inserting a link node. And we want to know when the file finished loading in order to call a callback function for example. Long story short: turns out this is harder than it should be and really unnecessary hard in Firefox. I hereby beg on […]

 

Command-line CSS spriting

Feb 19th, 2011

(In Russian) OK, CSS sprite tools exist. I’m pretty confident I actually made the very first one But they break from time to time (like mine currently). And then the command line is cool (as opposed to scary) and oh-so-quick. And imagemagick is cool and oh-so-powerful. So let’s see how we can create CSS sprites […]

 

CSS railroad diagrams

Nov 28th, 2010

So next step after the sexy CSS lexer is parsing. But first – railroad diagrams to help visualize how/when the tokens make sense forming valid CSS code. Below is what I have so far. It includes pretty much everything except selectors. Selectors are getting increasingly complex, come to think of it. There are probably mistakes […]

 

CSS Lexer

Nov 27th, 2010

I have so much stuff to do and I’ve been feeling a little overwhelmed lately. Not depressed, because it’s next to impossible to be depressed at a climate including 320 sunny days a year and a beach. So I thought why not drop everything and relax. I’m currently staying at home, enjoying my unused vacation […]

 

CSS minifiers comparison

Oct 30th, 2010

Last year I compared some CSS minifiers, namely YUICompressor, CSSTidy (with “small” vs. “safe” settings), PHP PEAR’s CSS lib and Minify (detailed results). Now that I’ve done some work on the YUICompressor and since there’s a new kid on the block from Microsoft I thought I should give it another go. I only compared CSSTidy […]

 

cssmin.js in windows shell

Oct 29th, 2010

JavaScript can run virtually anywhere, including as a windows exe and the windows command line. Say you have a JavaScript function foo() function foo(input) { var output = input; // .. unicorns return output; } In order to make this a windows shell script you add at the and a way to read standard input […]

 

Inline MHTML+Data URIs

Oct 3rd, 2010

MHTML and Data URIs in the same CSS file is totally doable and gives us nice support for IE6+ and all modern browsers. But the question is – what about inline styles. In other words can you have a single-request web application which bundles together markup, inline styles, inline scripts, inline images? With data URIs […]

 

The proper MHTML syntax

Oct 3rd, 2010

Reducing the number of HTTP requests is a must, sprites are cool, but a pain to maintain, so there come data URIs (for all browsers) and MHTML (IE6 and 7). I’ve talked about these things on this blog to a point where the blog comes up in top 10 results in search engines for queries […]

 

Conditional comments block downloads

May 23rd, 2010

I came across this blog post (via @pornelski and @souders) where Markus has stumbled upon a case where an IE6-only stylesheet included with a conditional comment blocks the downloads in IE8. Whaaat? I had to dig in. To give you a summary: turned out that any conditional comment, not only for an extra CSS, will […]

 

YUI CSS min – part 3 – hacks

May 21st, 2010

The previous parts are here (building and testing) and here (what gets minified). Now let’s see how YUI CSS min handles CSS hacks. As you know CSS hacks often use errors in CSS parsers in browsers to target specific browser versions and supply additional rules to work around other issues in said browsers. That makes […]

 

YUI CSS Min – part 2

May 20th, 2010

The first part is here. It was more about building the YUICompressor, writing and running test cases. Now let’s see what the compressor does exactly to your CSS. BTW, you can play with the web UI to see for yourself how the minifier works. Stripping comments and white space This is the bare minimum a […]

 

15 minutes could save you…

May 17th, 2010

Since I have a ton of things to do, I decided it was about time to spend some time with this blog, performance optimization-wise. Not do anything special, just the bare minimum, the no-brainer, works-every-time, easy stuff. And I’m quite happy with the results. I only looked at the homepage, although the results will be […]

 

Browser sniffing with conditional comments

May 13th, 2010

Browser sniffing is bad. But sometimes unavoidable. But doing it on the server is bad, because UA string is unreliable. The solution is to use conditional comments and let IE do the work. Because you’re targeting IE most of the times anyway. In fact IE8 is a decent browser for the most practical purposes and […]

 

Preload CSS/JavaScript without execution

Apr 21st, 2010

Preloading components in advance is good for performance. There are several ways to do it. But even the cleanest solution (open up an iframe and go crazy there) comes at a price – the price of the iframe and the price of parsing and executing the preloaded CSS and JavaScript. There’s also a relatively high […]

 

Publishing 5 books this year

Apr 1st, 2010

So I’ll be publishing 5 books this year. Isn’t that incredible? Is it even possible? And good quality books at that? It’s a nice challenge (my last year’s challenge failed, I didn’t even bother to count how bad it failed). I think it’s possible, especially if you bend a little bit the meaning of “5″, […]

 

YUICompressor’s CSSMin

Mar 10th, 2010

Honored to be a part of the YUI project, I am now helping with the maintenance of the CSSMin part of the YUICompressor. My changes are now part of the trunk on github, so I’m official. Next on the agenda is documenting the thing, so that’s what I’ll try to do here, maybe in a […]