6 ms·
>> background-position and border-spacing (all 2-axis properties) should take vertical first, to match with the 4-direction properties like margin. I disagree.
by riggsdk 6y ago
>> background-position and border-spacing (all 2-axis properties) should take vertical first, to match with the 4-direction properties like margin.
I disagree. We are inherently used to 2D coordinate systems being X, then Y.
I would instead have made the directional properties go “left, top, right, bottom” instead.
- realusername 6y agoI also have the same opinion, if you did not know anything about CSS, nobody would pick "top" to be the first one instead of just "left".
- paulryanrogers 6y agoReally? What about cultures that write right to left or vertically?
- pbhjpbhj 6y agoSo, I'm sitting down to create CSS ... what does the browser need to do first: margins on body ... which of them comes first as you scroll down: the top of the body ... If you came from print publishing, and assume that the browser handles the gutter spacing with defaults then it might even be argued that the right margin should come next! It's just something you have to learn, none of the options seem more logical to me. Note I first wrote HTML using pico on a Sun workstation in ~1995; developing with the developments in web development probably causes one to develop strangely. Or, in other words, it's hard to take a fresh view when you've had to deal with IE5.
- asiachick 6y agoMaybe someone that looked at a clock or compass? TRBL matches 12o'clock, 3o'clock, 6o'clock, 9o'clock. It also matches N E S W going around the circle I agree that I'm more familiar with left being first but then should it be LRTB or LTRB. LRTB is common to say. But many APIs take x,y first which would arguably be LT. Basically I think you could justify almost any order
- wizzwizz4 6y agoThere are several orders that make sense: • left, right, up, down • North, South, East, West • clockwise from the top • anticlockwise from positive x • +X, +Y, -X, -Y The list goes on. Consistency is the most important thing.
- soperj 6y agoother properties like padding, and margin take vertical first. They're asking for consistency.
- layoutIfNeeded 6y ago>We are inherently used to 2D coordinate systems being X, then Y. I once wasted a whole afternoon looking for a bug until I realized that atan2 takes y first, then x. https://www.cplusplus.com/reference/cmath/atan2/ https://www.cplusplus.com/reference/cmath/atan2/
- mstade 6y agoI just straight up think short hand properties the way they are designed are a bad idea. I've been writing CSS for about 15 years at this point, and I still can't remember the order of any short hand, I have to look it up every time, so I just type it all out instead. At least then I know what I'm looking at when I look at the code next time 'round. I'd rather see something like named parameters, e.g.: margin: top(1rem) left(2rem) right(2rem) bottom(1rem); margin: vertical(1rem) horizontal(2rem); margin: all(1rem); Or some such – I dunno I'm no language designer.
- ivanb 6y agoTop, Right, Bottom, Left is easy. Just remember this initialism: TRouBLe.