有人可以帮我弄清楚如何将我的菜单栏(w/id =“topnav”)放在我的HTML页面顶部?我尝试了一些背景大小的东西,似乎没有任何工作。我希望它是固定的,并在滚动时水平填充页面。在CSS中格式化topnav
#topnav a{
text-decoration: none;
color: #000;
padding-left: 50px;
padding-right: 50px;
padding-bottom: 10px;
}
#topnav{
font-family: Courier;
text-align: center;
padding: 15px;
position: fixed;
left: 50%;
transform: translateX(-50%);
background: white;
/*background-size: 100% auto !important;*/
}
也提供您的HTML –