根据宽度调整固定元素的底部属性

Adjust fixed element's bottom property according to width

如何相对于屏幕宽度调整固定元素的底部属性?

#element {
    position: fixed;
    bottom: window.width * 0.5; /* ? */
}

您可以使用 calc() css 属性。 http://www.alsacreations.com/article/lire/1630-la-fonction-calc-en-css.html 或者只是百分之一 http://www.w3schools.com/cssref/pr_pos_bottom.asp

添加波纹管 CSS 以相对于 screen-width

调整固定元素底部 属性
#element {
position:fixed;
width: 100%;
bottom: 0;}

使用% 例如:bottom:5%; width:100%; 它会随着屏幕尺寸调整

如果您想使用屏幕宽度,您会喜欢 vw 而不是 % 什么意思 'Viewport width' 或屏幕高度为 vh(视口高度)

代码将是 bottom: 50vw

谨致问候