应该有其他方法来解决您的问题。你面临这个问题是因为你的导航
position: fixed
而且
width: 100%
另一方面,您添加了
padding-left: 300px
到nav的父元素(和其他元素),但当您有
fixed
元素,它不会调整到其父元素,只是移动
npx
到两侧。
请注意
:这不是唯一的解决方案。
CSS
:
nav {
color: #fff;
background-color: #ee6e73;
width: calc(100% - 300px);/* this will fix your issue */
height: 56px;
line-height: 56px;
}
更新您的
nav
或者在主css文件的最后一行添加上述代码。
更新:
这正是解决这个问题的方法
在下面
/**
* Layout CSS
*/
header, main, footer {
padding-left: 300px;
}
/**
* fix the left align for brand-logo
*/
nav {
width: calc(100% - 300px);
}
@media only screen and (max-width : 992px) {
header, main, footer {
padding-left: 0;
}
/**
* allows the menu button to be left-aligned in < 992px screen
*/
nav {
width: 100%;
}
}