The Future of Style aggregates posts from various blogs that talk about the development of Cascading Style Sheets (CSS) [not development with Cascading Style Sheets]. While it is hosted by the W3C CSS Working Group, the content of the individual entries represent only the opinion of their respective authors and does not reflect the position of the CSS Working Group or the W3C.
If you want to get a taste of using the CSS 3 Template Layout module, Alex Deveria has written a jQuery plugin which implements the syntax.
I haven’t had the opportunity to try it out yet, so let me know how you get on.
So, the CSS Working Group is trying to wrap up the CSS3 Backgrounds and Borders Module and prepare it for Last Call. However, there are still some open issues we’d would like to get comments on.
Most of the open issues revolve around
border-image
. Brad Kemper knocked down several with
his
proposal and the CSS Working Group has adopted it in principle.
(You can find it drafted into the
latest unofficial Editor’s Draft on the W3C site.) We’re still
ironing out the details on that, but there are a few others still
open on border-image
:
First Issue: Several people have commented that
they would like a way to clip out the center part of the image.
There are two options for this: A) Keep the middle part by default
(current behavior). Add an empty
keyword that clips
out the middle part. B) Make the middle part clip out by default.
Add a fill
keyword that keeps it. (It’s needed for
stretch-tiling things like aqua buttons.) Of course we might also
just keep the current solution, C) have authors make that part of
the image transparent. Comments? What would you use?
Second Issue: The syntax is particularly
arcane. One commenter suggested breaking up
border-image
into multiple properties, leaving
border-image
itself as a shorthand. For example,
border-image: url(...) 20% 40% / 10% 4em 20% / 0 1em;
would be equivalent to
border-image-source: url(...); border-image-slice: 20% 40%; border-image-widths: 10% 4em 20%; border-image-outset: 0 1em;
This would also allow the values to cascade independently, making it easy to e.g. swap just the image. There’s an overhead cost to more properties, however, so if we do this there needs to be a significant and useful advantage. Thoughts on this idea, or any other ideas for making border-image easier to understand?
Third Issue: There’s still an open question of
how border-image
should interact with
box-shadow
. The two proposals on the table are: 1.)
Ignore box-shadow
when border-image
is in
effect. (The author can draw the shadow directly in the
border-image.) 2.) Use the border-image as a mask to draw a shadow,
but only draw the shadow where it appears outside the padding edge
(inner border edge). Comments? Preferences?
Fourth Issue: The next topic is fallback colors: the current draft has a feature that lets you specify a background color to use only if the bottommost background image fails to load. The WG wants to know, is this feature something authors really want? Several WG members have posted comments saying that it’s too hard to understand, that it’s not useful, and that the proposed syntax doesn’t make sense. What do you think?
Fifth Issue: The last issue is, the
current draft specifies a background-clip: no-clip
feature that lets a background image spill out of the border box.
Implementors are concerned that it’s tricky to implement, and
aren’t convinced that it would be useful. If this is something you
want, show off a realistic example or two that demonstrates why it
is needed.
Off-topic Issue: While I’m here, the WG wanted
me to ask what people thought of renaming the
block-progression
property to block-flow
or block-direction
and whether either was more
understandable (or if anyone had better ideas). The property
changes the direction of block layout, and the values are
tb
(horizontal lines stacked top-to-bottom, like
English text), rl
(vertical lines stacked
right-to-left, like traditional Chinese text), and lr
(vertical lines stacked left-to-right). This is for vertical text
layout, btw; it’s different from graphical rotation. See pages 2-5
of UTN
22 (PDF/HTML+SVG)
for a definition.
P.S. Could someone please fix the css3.info style sheet so it doesn’t effectively eat list markup? Thanks.
The CSS Working Group had a face-to-face meeting in Tokyo last month and made a series of resolutions (which can be found on their blog). Most are fine technical points, but one of the more interesting is that the multi-column layout module is about to be reissued as a ‘last call’ document; after this, the module will be released as a candidate recommendation, meaning the authors are satisfied that the standard does what is needed of it, and will call for implementation.
As you may know, Webkit browsers (Safari, Chrome, etc) already support multi-column declarations (with a -webkit- prefix) and Gecko browsers (Firefox, Camino, etc) partially support it (with a -moz- prefix) - and fuller support will be forthcoming in Firefox 3.5. With those implementations in place, I’m hopeful that it will pass quickly through the recommendation process and become a standard.
Last week saw another layout proposal, the template layout module, reissued as an updated working draft. Previously known as the advanced layout module (and featured in our article How We’ll Lay Out Websites in 2016).
As a quick reminder, template layouts allow you to assign content to ’slots’, which can then be laid out by declaring a grid using alphabetical characters. The following code would set up a two row grid, with the top row spanning the three individual columns of the bottom row:
body { display: 'aaa' 'bcd'; }
You could then match elements to each slot by using pre-existing selectors and the position attribute:
div#div1 { position: a; } div#div2 { position: b; }
And also use the new slot pseudo-class to apply styles:
body::slot(a) { border: 1px solid; }
This is probably the most radical proposal since the CSS standard was first created, allowing for very flexible template layouts, and I’m quite excited about it. However, it currently has no implementation, so is doubtless a long way off. Perhaps my satirical date of 2016 is not too wide of the mark after all.
The W3C have announced the creation of four new modules for CSS Level 3. The modules add entirely new functionality and do not extend any previous CSS Level 1 or Level 2 functionality. They are based on proposals from Apple’s WebKit team, and the current drafts are available from the following URLs:
The new modules are all in Working Draft status at present, and are going to be developed in unison with related SVG technologies.
An interesting implementation has recently made its way into the latest Webkit nightlies - a detailed method of styling scrollbars using a combination of new pseudo-elements and pseudo-classes.
Although the new syntax can seem complicated at first, Webkits
implementation gives authors the ability to completely alter the
look and feel of scrollbars of overflow sections, listboxes,
dropdown menus & textareas, and when used in conjunction with
border-image
and multiple backgrounds, the results can
look beautiful.
Whitepaper gives more details on the implementation.
This is a new tool that helps you to locate a country or territory on a map of the world. Ever wondered where Khazakhstan is? This will show you.
The map is in SVG and expands to fill the window. Territories are coloured red. Very small territories are marked by a red dot.
The map comes from Wikipedia. The list of territories comes from the regions listed in the IANA Language Subtag Registry. I can’t guarrantee that all the territories in the pulldown list are viewable, but nearly all are.
It’s quite a big SVG file, so it takes a little while to draw. I’ll try to speed that up in the future. It seems to draw much faster on Chrome or Opera than on Firefox or IE.
For the future I have some other ideas, such as displaying the country name natively, and linking to Wikipedia articles, CLDR data, etc. But that’s for later.
Update: Almost every time I located a country, I found myself wondering what the countries alongside are. So now as you move your mouse over a country, the name of that country pops up. (I approximate the location at the moment, but that doesn’t work so well if you zoom, so when I have some spare time I’ll add fixed locations for the labels.)
Enjoy.
The CSS Working Group has just published a new Last Call Working Draft of the Selectors module. This working draft addresses many comments that have been received since the last publication. The Last Call period extends until April 7th; please send any comments to www-style@w3.org. Note that we will not be accepting new feature requests for Level 3. Assuming no major problems are found, we will be republishing a Selectors Candidate Recommendation in April.
widows
and
orphans
can only accept integers >=1 for CSS2.1 Issue
105.:lang()
wording from Selectors draft for CSS2.1 Issue
68.box-shadow
should
work with border-image
. Text should require using
alpha channels of image to mask shadow and clipping inside padding
box (outer shadows) or outside border box (inner shadows).font-weight: bolder/lighter
and
jdaggett's proposal to just step up/down the numerical scale that
avoids need to reference font data rather than tracking the actual
weights available. WG seems to want to move in that direction,
jdaggett will write up and send to www-style.local()
doesn't require
quotes, format()
does.format()
is
authoritative. User agents must not download or use formats they
don't support as indicated by format()
.src()
in a single @font-face
that are
both supported only the first is used.unicode-rang
e is the intersection of the font cmap and
stated unicode-range
.unicode-range
initial value should be 0-U+10FFFF&&
notation
to 2.1 unless somebody comes up with something better, to avoid
having to publish a syntax module for just that one new
notation.calc()
, option to revisit later if it's
a problem.border
shorthand resets
border-image
.border
shorthand cannot
set border-image
.margin-break: [ auto | discard
| keep ]
to control margin-before at page-breaks. auto is
behavior described above. Can add second value to control
margin-after (defaults to discard).page-break-before,
page-break-after: column
to force column breaks, other
values apply to column breaking as well as pages.image-resolution: normal | [ <dpi> || auto ]
Rationale: Removes unused combinations and
unnecessary comma.image-resolution:
auto
with image-resolution: from-image
.
Rationale: auto
vs.
normal
is hard to understand. ('normal' is 1 pixel ==
1px).image-resolution
applies to all images and we will introduce functional notation in
the future to allow setting resolution on a per-image basis.aspect-ratio
and
device-aspect-ratio
in Media Queries, no changes to
syntax.width
and
height
properties apply to the page box, follow rules
in CSS2.1:10 wrt calculating margins. This behavior is
at-risk.Rationale: Japanese layout requires
setting the page area size, then using auto margins to position the
box on the paper.Also had a joint meeting with part of the Japanese Layout Task Force (see JLREQ. Discussed various tricky issues that will feed into various CSS drafts, including:
list-style-type
's value
armenian
maps to upper-armenian
.The major changes in this version include a new feature to normalise text as NFC or NFD, the ability to accept decimal code point values, and an overhaul of top part of the user interface.
Added buttons to the Text area to allow conversion of the text to NFC or NFD normalization forms. (You may not notice the change until you list the characters.)
The control panel was also substantially rearranged again to hopefully make it easier for newcomers to see what they can do.
The Code point conversion feature was upgraded to handle decimal code point values.
A single character in the codepoints area or text area is now
listed in the lower left panel when you click on , rather than in the right-hand
properties panel. This is to improve consistency and avoid
surprises.
Added a link to the CLDR property demo from the right panel to give access to additional properties.
Improved the parsing of codepoints when surrounded by text in the Code point input field, so that it now works with &#x…; and \u… and \U… escapes.
Jettisoned some unneeded code to reduce download by around 40-50K bytes. Implemented the NFC/NFD feature using AJAX, to avoid putting the download size back up.
When you delete the contents of the text area or the code point area, the associated input field is given focus, so you are ready for input.
A couple more minor bug fixes.
We've published a new snapshot of the CSS Namespaces test suite. This one is a Release Candidate, meaning it's considered complete, has at least one almost-passing implementation, and contains no known or suspected bugs at its publication. This test suite was written primarily by Anne van Kestern of Opera Software.
box-shadow
is not
suppressed by border-image
.
Rationale: It's useful in many cases to have both,
and the author can usually suppress it himself as needed.background-clip:
content-box
. Rationale: The content box is
useful for positioning, but not useful as a clipping rectangle, and
having this value makes the background
shorthand
difficult for getting the useful case (positioning by content-box,
but clipping per border-box) and easy for getting the not-useful
case (clipping to content-box).::selection
from
Selectors Level 3. Rationale: It's vastly
underspecified, and implementations are not interoperable. We can
add it back in Level 4 once we have a good definition.Postponed discussion of margins at page breaks to Tokyo F2F.
background-image
property.I was asked to make available the code for my normalization functions in JavaScript and PHP. The links are below. I’m making the code available under a Creative Commons Attribution-Noncommercial-Share Alike licence.
Disclaimers Note that I make no claim to have produced polished, compact or well-optimised code! The code does what I need, and I’m happy with that. You are welcome to suggest improvements, and I’m sure there are many that could be made.
As they say, this code is made available in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
The code is a little more convoluted that it ought to be, to get around the fact that JavaScript doesn’t understand supplementary characters, and PHP just doesn’t naturally understand Unicode. (How I long for PHP6.)
Update: [[I meant to mention that there is a way of doing normalization in PHP already. I made this code available just because I had it. I created it as a learning exercise. It may be useful, however, if you are unable to load the ICU and intl packages onto your server.]]
To use the code, simply call
nfc('your-text-string')
or
nfd('your-text-string')
from your code and capture the
result.
For PHP you’ll need these routines and this data.
For JavaScript look at these routines and this data. There is also a lite version of the data file that doesn’t include Han characters. I use this sometimes for bandwidth savings (about 14K less).
Test files I also created some test files for
PHP and for
JavaScript.
Both of these expect to find a copy of http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt
in the local directory. These files run 71,076 tests.
Cautions Be careful about the editor you use for the data files. I spent several hours fruitlessly debugging the routines, only to find that Notepad++ was displaying certain supplementary characters ok, but corrupting them on save. I switched to Notepad and the problem evaporated. And I probably don’t need to add that editing the data files in something like DreamWeaver is a bad idea because it will probably normalize the data before saving.
Another point: you may see Unicode replacement characters at a couple of points in the PHP source. These represent the first and last characters in the high surrogate range.
Experimenting If you want to play with something that uses this you could try my Tłįchǫ (Dogrib) character picker, or my Normalizer tool. I will slowly fit this to all the pickers and to UniView. I have a local version of UniView waiting in the wings that uses the PHP files via AJAX, to reduce download size. For that you need a file that returns the result as plain text across the wire, such as this.
Well, I hope that that may be of use to someone, somewhere. I hope I haven’t forgotten anything.
This tool allows you to normalise short pieces of text to Unicode forms NFC or NFD. You can paste the relevant text into a text area, or append it to the uri that calls the page, eg. Vietnamese example.
Note that, although I spell normalisation in the British way in this post, the uri uses the American spelling, since I suspect most users of the tool will expect it to be spelt that way.
Wondering what normalisation is? In Unicode a letter like á can be represented by a (precomposed) single character or by an a followed by an acute accent (a decomposed sequence). Unicode regards these two representations as formally equivalent. If you are comparing strings, therefore, you need to know which representations are equivalent. Usually you would want to normalise your text prior to comparison to a given normalisation form, so that the comparison process can be efficient. Unicode defines four normalization forms, two of which, NFD and NFC, are handled by this tool.
Basically NFD reduces all precomposed characters to their decomposed equivalents, whereas NFC uses precomposed characters for most common situations.
If you have a post you want to add to this feed, post a link (or the whole thing) on the CSS3 Soapbox. If you own a blog with frequent posts about the future of CSS, and want to be added to this aggregator, please get in touch with fantasai.