What does 100% mean in CSS? (2020)
wattenberger.com
What does 100% mean in CSS? (2020)
1–10 of 72 posts
Re: What does 100% mean in CSS? (2020)
#2 inset:0rem;
margin: auto;
it will center vertical and horizontal it without having to translate itcourtesy of Kevin Powell - https://www.youtube.com/watch?v=HOM47v73yG8 ( who I've found to be an amazing resource for learning all kinds of CSS info )
Re: What does 100% mean in CSS? (2020)
#3Re: What does 100% mean in CSS? (2020)
#4I always trip up on height/width being a % of the parent, and just default to using vh instead.
Re: What does 100% mean in CSS? (2020)
#5Most of the time, an element's containing block is its parent, but not always.
For more on this: https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_...
Re: What does 100% mean in CSS? (2020)
#6Just a little correction: percentage values are computed based on the element's _containing block_, not parent. Most of the time, an element's containing block is its parent, but not always. For more on this: https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_...
Re: What does 100% mean in CSS? (2020)
#7 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 thought-out it was underneath.
https://developer.mozilla.org/en-US/docs/Web/CSS/background-...
Re: What does 100% mean in CSS? (2020)
#8Re: What does 100% mean in CSS? (2020)
#9However, does this not make it much easier to understand if you are clear and understand the CSS Box Model[1] very well. I remember visualizing it in my head in kinda 3D model of the CSS Box, whenever something obvious do not work while placing objects on the page/layout for the browser. Once you know where your bearing and browser quarks, either you position your mark or find another way inside the Box.
I'm hoping they haven't change the CSS Box Model.