【发布时间】:2014-02-01 03:34:25
【问题描述】:
当另一个固定的右侧 div 应该从右侧推送时,如何推送 100% 宽度的固定顶部 div?我正在制作一个可折叠的移动菜单。它由顶部固定 div 上的按钮切换。现在,右侧的固定 div 与顶部的固定 div 菜单按钮重叠。我希望此按钮在屏幕上向左移动,以便始终可见。我该如何做到这一点?我没有在 CSS 中使用固定元素做很多工作。感谢您的帮助。
注意:通过缩小浏览器窗口的大小,您只会看到我所说的菜单和菜单按钮。此菜单专为移动布局而设计。
网站:
CSS:
#slide-menu {
margin-right: -250px;
right: 0;
top:0;
width: 250px;
background: #222;
position: fixed;
height: 100%;
overflow-y: auto;
z-index: 10001;
font-family: Roboto,sans-serif;
color: #fff;
font-weight: 100;
font-size: 1.5em;
}
#push{
/* This is the div that holds the menu button */
position: fixed;
top: 0;
padding: 0 1em;
background: #366982;
width:100%;
display:none;
z-index: 10000;
}
截图说明:
菜单关闭:http://prntscr.com/2oaf82
菜单打开,按钮重叠:http://prntscr.com/2oafv4
【问题讨论】:
标签: css html responsive-design fixed