I'm Tab Atkins

and I work at Google.

@tabatkins

+Tab Atkins

xanthir.com

The Future of CSS

...or at least, some of it.

Image Values
Gradients!

Use an element as an image!

The image() function

Basically a souped-up url()

Control how an image is scaled

image-rendering tells the browser what you expect when an image is scaled


Flexbox!

Basically, display:block for applications.

Dumps much of the text-related complication in favor of simpler, more useful abilities.

Basic Example

Thousands of household uses!

Grid Alignment!

Finally, a layout system designed for pages.

Slice the page into cells, and position elements into those cells.

No extraneous markup, no source-order dependence, fully flexible.

Example

Regions!

Let you flow text across multiple areas of a document.

Similar conceptually to multicol, but more freeform.

The End?

Questions and Answers

@tabatkins

+Tab Atkins

xanthir.com

CSS Variables!

Variables! In CSS! OMG!

A common request for literally over a decade.

Why so long?

Previously, discussion was paralyzed by indecision and argument.

Now we have rough agreement on the solution, and are starting experimental implementations.

Var Example


@var $header-color #006;
@var #main-color #06c;
@var #secondary-color #c06;
a { color: $main-color; }
a:visited { color: $secondary-color; }
h1 { 
  color: $header-color;
  background: linear-gradient(left,$main-color$, transparent 25%);
}
	

CSS Nesting!

Stylesheets often have tons of repetition in the selectors.

"#main > header > h1", "#main > header > h1 > a", "#main > header > h1 > a:visited", etc.

Verbose, hard to read, prone to hard-to-see errors

Nesting Example


#main > header > h1 {
  font-size: 2em;
  background: blue;
  color: white;
  & > a {
    color: #ddf;
    &:visited {
      color: #fdf;
    }
  }
}
	

Just syntax sugar for the long-form stuff.

Again, CSS preprocessors led the way.

Shorter stylesheets, better organization mean faster app development.

Explicitly indicates scoping opportunities, which might be useful for browser perf

The End

Questions and Answers

@tabatkins

+Tab Atkins

xanthir.com