[CSS Gap Decorations] Proposal for restructuring the rule
syntax + Extending the -outset
/-offset
property
#996
Labels
rule
syntax + Extending the -outset
/-offset
property
#996
Chief Concerns
Usage of
row-
andcolumn-
prefixed property namesThe current proposal for drawing separator rules between Flexbox and Grid items use
row-
andcolumn-
prefixes. This approach is physically dependent and may not be as flexible when considering writing-mode and layout agnosticism. In most cases, developers won't find the need to style vertical and horizontal rules differently.Stylistically, this isn't too reminiscent of more familiar and related modern CSS properties like the
border
property. This might cause early adopters and new developers to often stumble upon the wrong syntax when mentally switching between usingborder
andrule
properties, especially if they're building flexboxes instead of grids.Enforced symmetry in the
-outset
/-offset
propertyThis is more of an opportunity than a concern as the proposed spec by Microsoft also potentially could allow the
rule-offset
property to be asymmetric. To be honest, a very weak concern at worst since the-outset
property proposal is pretty solid and well thought out already.A number of UX designers like to play around with the size of the separators relative to the grid itself but can also want to align the separators to the baseline without extending them all the way vertically (Case #3 above). Oftentimes, this can result in no-so-granular cases like the ones illustrated in the article where the
*-rule-break
property was hinted at. Hence, we might need a new property to allow developers to easily implement such design requirements.Proposal
I suggest we take a page from the
border
bookUsing
rule
shorthand with additionalrule-block
andrule-inline
propertiesThis ensures layout agnosticism, preventing users from rewriting rules for responsive flexboxes and grids that can go from a single row to a single column layout depending on the viewport size.
Before
After
Or, if you still want to do rows and columns separately,
rule-offset
propertyBased on the exposition I've given in the previous section, this is quite self-explanatory. Trying to respect layout agnosticism, we can define this property like so, very loosely taking inspiration from
outline-offset
andmargin
andpadding
rules,Or, if you want to define the offsets for vertical and horizontal separators separately (no pun intended),
Not only is this more extensible and general than the proposed
*-rule-break
and*-rule-outset
rules, allowing pixel level control of these properties in any direction. It also uses a much more familiar syntax and structure.Final Words
Really excited at this new proposal! I hope we can also make it resemble more mature and established CSS rules to allow easy adoption and keep the syntax consistent. Also see quite a bit of opportunity for extending this property even further. Would like to know your thoughts!
The text was updated successfully, but these errors were encountered: