css 各种百分比的指向

相对于父级宽度的:

max-widthmin-widthwidthleftrighttext-indentpaddingmargingrid-template-columnsgrid-auto-columnscolumn-gap 等;

相对于父级高度的:

max-heightmin-heightheighttopbottomgrid-template-rowsgrid-auto-rowsrow-gap 等;

相对于自身宽高的:

border-radiusbackground-sizeborder-image-widthtransform: translate()transform-originzoomclip-path 等;

相对于主轴长度的:

flex-basis 等;

相对于继承字号的:

font-size 等;

相对于自身字号的:

line-height 等;

相对于行高的:

vertical-align 等;

如果自身设置 position: absolute,“父级”指:相对于离它最近的那个 position 不为 static 的祖先元素,如果没有这样的元素,则相对于视口

如果自身设置 position: fixed,“父级”指视口(父级不存在 transform 为非 none 值的情况下)。

欢迎关注、点赞

猜你喜欢

转载自blog.csdn.net/qq_33576343/article/details/81806035