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

css 样式的百分比都相对于谁? #18

Open
hoperyy opened this issue Jun 25, 2017 · 1 comment
Open

css 样式的百分比都相对于谁? #18

hoperyy opened this issue Jun 25, 2017 · 1 comment

Comments

@hoperyy
Copy link
Owner

hoperyy commented Jun 25, 2017

  • 相对于父元素宽度的

    [max/min-]widthleftrightpaddingmargin 等;

  • 相对于父元素高度的

    [max/min-]heighttopbottom 等;

  • 相对于继承字号的

    font-size 等;

  • 相对于自身字号的

    line-height 等;

  • 相对于自身宽高的

    border-radiusbackground-sizetransform: translate()transform-originzoomclip-path 等;

  • 特殊算法的

    background-position(方向长度 / 该方向除背景图之外部分总长度 * 100)
    filter 系列函数等;

  • 父元素

    • 如果自身设置 position: absolute

      “父元素”指:相对于离它最近的那个 position 不为 static 的外层元素,如果没有这样的元素,则相对于窗口。

    • 如果 position: fixed

      “父元素”指:视口。

@rccoder
Copy link

rccoder commented Aug 7, 2018

梳理的非常棒👍

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

No branches or pull requests

2 participants