html - 证明内容 : space-between works incorrect

标签 html css flexbox responsive

我有以下代码

header {
  width: 100%;
  height: 65px;
  background: #fff;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #252c3a;
}

#menu {
  width: 100%;
  display: flex;
  margin-left: 28%;
}

#menu div {
  width: 100px;
  height: 65px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
<header>
  <div id="logo">
      <img src="img/header/logo.png" alt="Logo">
  </div>
  <div id="menu">
      <div>Home</div>
      <div>Club-Life</div>
      <div>Training</div>
      <div>Instructors</div>
      <div>Contact</div>
  </div>

Chrome inspect

其他 block 的宽度为 100%,但标题宽度比下面的 block 大。我使用 justify-content: space-between.

最佳答案

移除宽度 & 边距

在头部添加flex-wrap

header {
    width: 100%;
    height: 65px;
    background: #fff;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #252c3a;
    flex-wrap:wrap;
}

#menu {
    display: flex;
    flex-wrap:wrap;
}

关于html - 证明内容 : space-between works incorrect,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59579406/

相关文章:

html - 对齐容器内图像旁边的文本

html - 当我从另一个链接页面单击返回时,我的页面设计会更改颜色/大小

javascript - 如何在 Shopify 中使用 gzip 压缩资源?

html - Flex 不占用宽度

css - 为什么这个 CSS 没有占据整个页面?

html - Chrome 字体大小加载较大然后减小

css - 您必须再使用 -webkit- 语法吗?

javascript - 构建一个简单的计算器

javascript - 如何从 html 页面中的静态 url 获取 JSON

html - 在 google chrome 版本 54 中,禁用字段是不可选择的