0

我不知道如何正确表达这个问题,我想在本网站的右上角创建类似徽标的内容:http ://www.afterthecircle.com/

当用户向下滚动时,徽标会随着滚动移动而移动,并且始终对用户保持可见。

有什么建议么?

4

3 回答 3

2

position: fixed与 top 或 bottom 以及 left 或 right 一起使用:

.logo {
    position: fixed;
    bottom: 1em;
    right: 1em;
}
于 2013-07-01T20:24:44.857 回答
2

正如 brbcoding 所说,您正在寻找值固定的 CSS 属性位置。使用属性 top、bottom、left 和 right,您可以定位元素。一个例子:

CSS

.fixedElement {
    position: fixed;
    top: 100px;
    left: 100px;
}

HTML

<div class=fixedElement>Hey!</div>
于 2013-07-01T20:26:06.197 回答
1

固定定位将允许您滚动并将项目保持在其原始位置。

#fixed-thing {
    position: fixed;
    top: 0;
    right: 0;
}

演示

于 2013-07-01T20:27:32.150 回答