【发布时间】:2016-07-03 20:29:02
【问题描述】:
我正在为我的网站创建一个导航器,它有 5 个按钮:Button1-4 和背景图像作为 Button5。
如果您将浏览器窗口的宽度最大化并仅按高度缩小,例如1280x300,您会看到 div 容器背景从按钮上消失了,这看起来很糟糕,请查看结果here。
根据我的研究,我已经尝试了所有似乎不起作用的选项,div menu 样式:
.menu {
position: fixed;
display: inline-block; /* did not work */
overflow: auto; /* did not work */
top: 0%;
left: 0%;
right: 0%;
background-color: black;
height: 100%;
width: 100%;
border-style: solid;
border-color: black;
border-radius: 3%;
z-index:99;
max-height: 15%; /* non of these below worked. */
max-width: 100%;
min-height: 15%;
min-width: 100%;
}
为什么即使超过了max 和min 的宽度,它也会随着窗口向下拉伸?如何避免我的 div 菜单使用浏览器进行拉伸和缩放? css 有哪些选项?
【问题讨论】: