Skip to content

[css-backgrounds] Order of values for border shorthands is unclear #5100

@vwkd

Description

@vwkd

The definitions of the order of values for the shorthands border-color, border-style and border-width seem a bit unclear. For all three the spec states

If it has four values, they set top, right, bottom and left in that order. If left is missing, it is the same as right; if bottom is missing, it is the same as top; if right is missing, it is the same as top.

So what happens with three or two values, e.g. border-width: a b c or border-width: a b? How does it know which side I left out?

By trial and error I know the order is the same as for the margin and padding shorthands. The definitions of margin and padding are much clearer though. The spec states

If there is only one component value, it applies to all sides. If there are two values, the top and bottom [..] are set to the first value and the right and left [..] are set to the second. If there are three values, the top is set to the first value, the left and right are set to the second, and the bottom is set to the third.

I would suggest taking over this part of the definition from margin / padding for the border properties as well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions