Live data from Hacker News

What does 100% mean in CSS? (2020)

wattenberger.com

51–60 of 72 posts

Re: What does 100% mean in CSS? (2020)

#53
post #7

Sadly the most interesting CSS percentage mechanic is missing there: background-position Unlike all other cases, here `background-position-x: [25]%` means: > "Place image so its inner left [quarter] boundary matches inner left [quarter] boundary of its container." So 0% = align left edges, 100% = align right edges, 50% = align centers (= center) etc. Super intuitive on the first sight, but I was quite surprised how t…

[deleted]

Re: What does 100% mean in CSS? (2020)

#54
post #7

Sadly the most interesting CSS percentage mechanic is missing there: background-position Unlike all other cases, here `background-position-x: [25]%` means: > "Place image so its inner left [quarter] boundary matches inner left [quarter] boundary of its container." So 0% = align left edges, 100% = align right edges, 50% = align centers (= center) etc. Super intuitive on the first sight, but I was quite surprised how t…

So it's equivalent to setting:

    left: x%;
    top: y%;
    transform: translate(-x%, -y%);

Re: What does 100% mean in CSS? (2020)

#58

> The surrounding blue box is the parent element. (R: 93, G: 200, B: 195) That's more green than blue. When you consider that humans have stronger green color preceptors it's definitely green.

You might be interested in this article: https://en.wikipedia.org/wiki/Blue%E2%80%93green_distinction...

"Definitely" green is a difficult assertion to make universal. It's true that it has slightly more green than blue in the sRGB space, but the blue/green boundary is not as culturally universal as you may expect

Re: What does 100% mean in CSS? (2020)

#59

> The surrounding blue box is the parent element. (R: 93, G: 200, B: 195) That's more green than blue. When you consider that humans have stronger green color preceptors it's definitely green.

That puzzled me too (“that’s not blue, that’s more like aqua”). I thought it was my monitor or something.
Post reply on HN