• 200922 Mar

    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.

    Example

    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.

  • 200921 Jan

    Believe it or not there still a lot of discussion around CSS 3. The concerns among designers/developers vary widely and we’ve found that our visitors use CSS3.info in many different ways.

    1. General questions about your CSS 3,
    2. Research for future-proofing your projects,
    3. Browser support issues and updates,
    4. Tutorials and how to’s on CSS 3 features,
    5. Goings on in the CSS world

    So there’s quite a range of information that we can get into and provide, but we would like some feedback from our readers so that we can continue to make the site a helpful resource.

    If you’ve done extensive work with CSS3, feel free to let us know via the contact form and perhaps you can provide us with a tutorial or review that we can feature on the site!

    Leave us a reply in the comments below and let us know what types of information you’d like to see us providing this year.

  • 200815 Nov

    There’s been an apparent need (voiced by the web community) for CSS-based Constants ever since the conception of CSS (even though there are many established server-side preprocessors in existance). From reading blogs and the like, people are either very much in favour or very much against the idea, but the feature’s mixed reception hasn’t stopped members of the CSSWG exploring and discussing the idea further, to the point where we now have two fairly detailed proposals from members of the Working Group. The aim of this post is to explore and then summarise the current state of both proposals (from an authors not a vendors point of view), comparing features of both.

    Back in March this year, Dave Hyatt and Daniel Glazman combined forces and presented the first formal proposal for Variables to the Working Group, and (based on this spec) Hyatt subsequently implemented the module into Webkit nightlies; the implementation was distributed for around 5 months, but was later removed due to concerns regarding feature adoption by authors before the spec had any time to mature. In August this year, fantasai submitted a counter-proposal which detailed plans for a parse-time syntax for Constants (which are lost after the variables are parsed and therefore not mutable), compared to Hyatt’s/Glazman’s proposal which allowed for scriptable Variables.

    Types of Constants

    Fantasai’s proposal features three types of named Constants, ‘values’, ‘style-sets’ and ‘selectors’; a value constant represents a property value, a style-set constant represents one or more property declarations and a selector constant represents a selector. Each are declared using an @define rule and as fantasai explains, the syntax of an @define rule is the @define at-keyword, followed by either the values keyword (for declaring value constants) or the style-sets keyword (for declaring style-set constants) or the selectors keyword (for declaring selector constants), followed by a block. Examples (ripped straight from her proposal :)) showing the syntax for each of the three Constants are below:-

    Values

    @define values { textColor: black; bgColor: white; accentColor: silver; accentBorder: double silver 5px; }

    Style-sets

    define style-sets { noteBox { border-style: solid; padding: 1em; border-radius: 1em; } quoteBox { margin: 1em; } }

    A feature of fantasai’s proposal is that constants are re-usable, so you can include ‘style-set templates’ which can be applied to multiple selector declarations, using different value constant values.

    Selectors

    Note that any selectors used in such a variable aren’t allowed to be grouped (using the comma-seperated grouping syntax), since we will have the ability to group selector variables anyway. Selector constants would be useful for repeatedly selecting child/grandchild etc elements deep within a complex DOM tree; consider this:-

    @define selectors { deeplynestedelement: body.home > div#main.container ~ ul#navigation > li a[href="http"] span#child > span#imrunningoutofnames;}
    deeplynestedelement u, deeplynested b{ color:red; }

    And with the addition of a possible :match() pseudo class in Selectors Level 4, you could do something like this to make the above statement even more organised:-

    deeplynestedelement:matches(u,b){ color:red; }

    Instead Hyatt’s/Glazman’s proposal simply utilises a new @variables rule in which any type of variable (presumably) can be used, without the need for type keywords – their proposal isn’t actually clear on whether different types of variables can be parsed (or whether this proposal simply targets value constants), however, after looking at several test cases, the implementation seems like it was capable of at least parsing ‘style-sets’ constants too.

    @variables { CorporateLogoBGColor: #fe8d12; }

    div.logoContainer { background-color: var(CorporateLogoBGColor); }

    Scoping

    Two fairly major differences between the two proposals are their scoping behaviour. In fantasai’s proposal, by default, the scope of a named constant does not ordinarily cross @import boundaries; this essentially means that the use of variables declared in one @import are restricted to that particular stylesheet, unlike Hyatt’s/Glazman’s proposal where, by default, constants cross @import boundaries. However, using fantasai’s proposal, authors do have complete control over the scope by using one of three new keywords (which is placed between the @import keyword and the stylesheet URI), push, pull and sync; pull allows constants declared within the imported stylesheet to be used in the importing stylesheet; push allows constants declared above the @import rule in the importing style sheet to be used the imported style sheet; sync allows both of the previous, simultaneously.

    The two proposals differ also in the way that constants relate to, and work with Media Types. In Hyatt’s/Glazman’s proposal, an optional Media Type keyword can be placed between the @variables keyword and succeeding block declaration. In fantasais proposal, constant declarations (placed within a @define block) can be nested within an @media block. However she metions, …if declared inside an @media rule, the scope of the declaration does not end with the @media block, meaning that constants can be used outside of the @media they’re placed in. It’s worth mentioning that the @media rule model/syntax differences could be trivially modified to use the other’s media type syntax.

  • 200815 Nov

    From the October F2F CSS Working Group minutes (Apple’s proposal); Apple presented their proposals for Animations and Transitions, made remarks on Transforms, gradients, reflections. All four major browser vendors are interested in these proposals, and it is very likely that the CSSWG will accept to work on them. Exciting stuff!

    Hakon presented a proposal for a border-parts property, which defines an on/off mask over the border as a series of lengths; you can check out his proposal in more detail on www-style. Note, this is still very much an unapproved proposal and the WG have stated that they are still unsure how usable/useful a solution such as this would be.

    Dave Hyatt and Daniel Glazman initially came up with a proposal for CSS Variables, and fantasai has now created a counter-proposal detailing plans for a purely parse-time, non-scriptable solution. To help distinguish between the merits of both, I’ve come up with a brief article comparing and summarising both proposals.

Hosting by: