The Book of CSS3 - A Developer\'s Guide to the Future of Web Design (2nd edition)

(C. Jardin) #1

254 Chapter 19


Sticky positioning is a kind of hybrid of relative and fixed positioning.
An element’s position is relative until it reaches a sticky threshold value, which
is a preset scroll position of the viewport. For example, in the following list-
ing, element E becomes sticky when the viewport scrolls down 20px from
the top:

E {
position: sticky;
top: 20px;
}

As of this writing, sticky positioning is in Safari from 6.1, with the value
-webkit-sticky, and unprefixed in Firefox. Chrome is expected to imple-
ment sticky positioning, and it is listed as “Under Consideration” in Internet
Explorer.

And Much, Much More


CSS is a living standard, undergoing constant development, whether
driven by the W3C, browser vendors, interested parties like Adobe, or the
web development community. In addition to the new features discussed in
this chapter, many more exciting CSS developments are being proposed,
debated, and developed. Some of these include, but are not limited to, the
following:

•    The ability to set different shapes for corners and allow clipped or par-
tial lines for borders
• The ability to apply the position keywords from Flexbox (Chapter 15)
to any element, causing big changes in the way elements are positioned
• Color functions that allow colors to be tinted or shaded easily and that
provide easier grayscale manipulation
• Extending the idea of custom properties to include custom selectors or
functions
• Grids based on lines of text, which are designed to allow better place-
ment of elements in content with a vertical rhythm
• Image values including sprites and fallbacks, and ones that can use ele-
ments as backgrounds

These features are mostly still at the theoretical stage, but they should
give you some insight into the level of thinking that’s going into the future
of CSS. And such is the rapid rate of change in the web industry, that
within a few months of reading this, doubtless many more novelties will
have been proposed.
Free download pdf