【发布时间】:2021-11-26 16:04:40
【问题描述】:
<body>
<div class="topnav">
<!-- Centered link -->
<div class="topnav-centered">
<a href="#" class="logo">
<img src="growmade2.png" style="height: 25px; width: 250px" alt="" />
</a>
</div>
<!-- Left-aligned links (default) -->
<a href="#news">SHOP</a>
<a href="#contact">EXPLORE</a>
<!-- Right-aligned links -->
<div class="topnav-right">
<a href="#search">MY CART</a>
</div>
</div>
** CSS **
.topnav {
position: sticky;
display: block;
background-color: rgb(255, 255, 255);
padding: 30px 80px 30px 50px;
}
.topnav a {
font-family: "Roboto", sans-serif;
font-family: "Roboto Condensed", sans-serif;
font-family: "Source Sans Pro", sans-serif;
font-weight: 900;
display: inline-block;
position: relative;
color: #000;
text-align: left;
margin: 0 10px;
padding-bottom: 2px;
text-decoration: none;
}
您好,我是 CSS 新手。我想创建一个带有静态导航栏的网站,但不能静态显示?任何人都可以解决这个问题吗?提前谢谢!!!
【问题讨论】:
标签: javascript html css sticky