小编Ale*_*lex的帖子

当位置设置为固定时,导航栏会缩小

我目前遇到一个问题,当我将导航栏和横幅的位置设置为固定时,它们会缩小。我有很多事情,例如更改 z-index、将其顶部位置设置为 0、添加自动边距等,但这些都不起作用。我希望有人能指出我的错误。这是我的html代码:

html,
body {
  margin: 0;
  background-color: #ffeecc;
  font-family: 'Chivo', sans-serif;
}

.container {
  margin: auto;
  width: 75%;
}

.nav_left {
  width: 100%;
  background-color: #258e25;
  height: 50px;
  float: left;
  text-align: left;
}

.banner {
  width: 100%;
  overflow: hidden;
  background-color: white;
}

.banner img {
  width: 70%;
  height: 150px;
  padding: 0 15%;
}

.top {
  position: fixed;
}

nav {
  text-align: center;
}

nav ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
  display: inline-block;
  width: 100%;
  height: 100%;
} …
Run Code Online (Sandbox Code Playgroud)

html css

3
推荐指数
1
解决办法
4584
查看次数

标签 统计

css ×1

html ×1