我有一个固定元素,它是一个带有一些链接的小菜单,可以在页面上跟随您。
我正在使用 Squarespace 并使用链接制作一个新的小部件。在 CSS 中,我放置了以下代码:
#moduleContent18520661 {
position:fixed !important;
margin: auto;
top:700px;
left:400px;
cursor:hand;
background:#efefef;
border:1px solid #ffcc00;
width:480px;
z-index:100;
}
Run Code Online (Sandbox Code Playgroud)
只有当我在我的电脑上对齐它时,它才能完美运行。当我看着我的笔记本电脑时,它太低了。
无论屏幕大小如何,如何将元素固定在屏幕底部?
如果您正在使用,position: fixed您可以明确定位到屏幕的底部或任何其他一侧:
#moduleContent18520661 {
position: fixed;
bottom: 0; /* the bottom edge of the element will
sit against the bottom edge of the window */
/* other stuff */
}
Run Code Online (Sandbox Code Playgroud)
只需删除top声明并替换为您希望元素的底部边缘与窗口底部边缘保持的距离。
此外,cursor应该cursor: pointer; 或应该cursor: pointer;遵循cursor: hand;,因为那是纯粹的 IE 6(如果我没记错的话)专有 CSS 属性值。
| 归档时间: |
|
| 查看次数: |
5117 次 |
| 最近记录: |