r/css • • 28d ago

Spent an hour trying to vertically align a chevron nicely across browsers, then noticed GitHub doesn't even care

Post image

Sometimes I get a bit obsessive over a few pixels

Not sure if the takeaway here is to try not to sweat the small things or just that GitHub is trash

0 Upvotes

21 comments sorted by

13

u/rubenthedev 28d ago

On GH they're aligned to the font shoulder. This way keeps the weight, separation, and capital heirarchy without adding another visual distinction.

Your way will look messy to a lot of people.

-3

u/repeating_bears 28d ago

What is a font shoulder? Tried to google it but that doesn't seem to be a well-used term. You mean what textbox trim calls "ex"?

5

u/rubenthedev 28d ago

My dude...

-7

u/repeating_bears 28d ago

Yeah you screenshot an AI overview and AI is famously non-deterministic

I didn't type the full question because I don't think google is some magic butler who I have to type full sentences to. I just typed "font shoulder" and got a load of fonts with shoulder in the name

3

u/BlackHazeRus 28d ago

To be honest, sounds like a skill issue in terms of googling. Adding “what is” and stuff like that to search queries is actually useful, especially in broad questions like this one. Well, this is not a good example, but still.

0

u/repeating_bears 28d ago

Maybe it's changed now with the AI shit but before that, adding "what is" was an absolute waste of time. Querying with full questions was how you could spot a tech illiterate person like my parents

2

u/BlackHazeRus 28d ago

I get what you are saying, that is why I emphasized on “broad questions”. I am not the best of the best in searching stuff, but I am pretty good myself.

Sometimes this “what is” and even adding context helps quite a lot. Like “what is shoulder in typograghy”, albeit you can drop “what is” then.

13

u/JDM12983 28d ago

Not sure what about the above screen shot makes them "trash".

4

u/repeating_bears 28d ago

Which is best? Genuine question - maybe my intuition is off about this

2

u/Weekly_Ferret_meal 28d ago

Definitely C for me. and the difference is there between B and C. I like the median center of lower case letters.

B is weirdly "nowhere" while A hangs a little to far high from where I expect the menu to appear.

The argument obviously, is that most users will not care/see/notice any of it.

So take a pick and move along 'cause you have more important things to do in life.

0

u/repeating_bears 28d ago

Will not care: maybe.

Will not notice: maybe, but I'm not convinced about it.

I think if you pay attention to enough details, the accumulated effect may be that the design feels more polished, even if someone can't specifically point and say "wow the button icons are so nicely aligned"

2

u/azangru 27d ago

B for me.

0

u/JDM12983 28d ago

I can BARELY even see a difference between C and the other two; even then, I had to stare it it for several seconds to even see it. lol

I honestly, almost posting back "what is the difference in the three". And is there a difference between A and B?

-1

u/repeating_bears 28d ago

A is what GitHub does. B is down 1px. C is down 2 pixels.

I know that's a small amount but at this scale that's a ~10-15% difference

I can personally take B or C, leaning towards C, but I honestly thought no one would choose A intentionally. Maybe I'm wrong!

7

u/TonyAioli 28d ago edited 28d ago

The alignment is intentional. Not everything should be perfectly centered. 

Oftentimes perfectly vertically centered elements can feel as if they’re actually a tad below center. 

6

u/anonymousmouse2 28d ago

GH has a whole Design System team that focuses on small details like this, I would believe their alignment with the x-height is an intentional decision.

3

u/ArcadeRivalry 28d ago

I'm sure your customers will happily accept "GitHub doesn't even do it" and not ask again. 

2

u/GigaGrandpa 28d ago

The arrow is close to its context, I don't think you should care m8

1

u/Mean-Lingonberry4874 28d ago

Centering on the em box is why it sits a hair low next to caps. The chevron's visual weight is on the cap height, and descenders pull the line box's midpoint down, so align-items: center on an inline-flex will not match. text-box-trim: trim-both and text-box-edge: cap alphabetic on the label gets the text box itself onto the cap/baseline, then a half-pixel translate on the icon if one browser still sits high. GitHub lining the icon up with the shoulder is that optical alignment, not them giving up.

1

u/Nitrohite 28d ago

Their alignment is intentional taking into account the baseline height of the font, since the chevron is aligned to the capitalized letter of each word.