Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

50% top margin resolves against width, not height. Use 50vh #23947

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

faceless2
Copy link
Contributor

As the subject says. A 50% margin-top will resolve against the width, not the height, so it's not halfway down the page. Use 50vh instead.

@TalbotG
Copy link
Contributor

TalbotG commented May 8, 2023

As the subject says. A 50% margin-top will resolve against the width, not the height, so it's not halfway down the page. Use 50vh instead.

Correct.

"
The percentage [for 'margin-top', 'margin-right', 'margin-bottom', 'margin-left', and 'margin' property] is calculated with respect to the width of the generated box's containing block. Note that this is true for 'margin-top' and 'margin-bottom' as well.
"
https://www.w3.org/TR/CSS22/box.html#margin-properties

http://wpt.live/css/css-masking/clip-path/clip-path-element-userSpaceOnUse-004.html

http://wpt.live/css/css-masking/clip-path/reference/clip-path-ref-bottom-green-ref.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants