Re: [css-backgrounds] border-position

On 03/07/2017 05:31 AM, Benjamin De Cock wrote:
> Hello,
> Has a `border-position` property (or similar) ever been considered?
> I couldn't find any discussion about it so, please let me 
> know if I'm missing something!

I've never encountered such a proposal. There is such a proposal
for SVG strokes, though.

> Plausible use cases out of my head:
> 1. Centering the border. With tools like Illustrator and Sketch displaying the border by default at the center (presumably for 
> SVG), it's often necessary to redraw/resize/realign the layers aimed at being implemented in CSS in order to account for the 
> different border positioning method. Additionally, some border effects are simply not possible today in CSS because of the 
> lack of proper centering (as in, border + outline isn't a reasonable hack).
> 2. While `box-sizing` can emulate a potential `border-position: inside`, the mental model of these properties are radically 
> different, and I tend to think designers would find the latter much more natural.

One of the key differences here is that the border in CSS takes
up space. It does this so that it doesn't overlap other content--
the browser can ensure enough space where needed, and the author
doesn't have to adjust margins/padding every time s/he adjusts
the border width. This is good behavior for a layout tool.

Illustrator and Sketch are drawing tools, so they would output
SVG shapes, not CSS boxes, in which case the 'stroke' property
is used, and that centers on the boundary as you expect.

Given that, I'm not really sure CSS needs a border-position.
Could be convinced otherwise, but it'd need more specific
examples of where it's needed. :)


Received on Thursday, 21 September 2017 16:39:55 UTC