css-尽管align-item:flex-start,justify-content:flex-start,flexbox继承父宽度

时间:2019-02-07 12:34:53

标签: css flexbox

想要的行为:我希望.container div调整为.chapers div的宽度,而该宽度应调整为.chapter-link div的宽度。 .container.btn div都应具有视口的当前高度(100vh)。

this question之后,我向容器中添加了justify-contentalign-itemsflex-start,但是问题仍然存在。

.container {
  background-color: blue;
  color: #fff;
  font-size: 16px;
  height: 100vh;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
}

.chapters {
  padding: 14px;
}

.btn {
  background-color: green;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chapter-link {
  margin-bottom: .5em;
    max-width: 200px; 
}
<div class='container'>
  <div class='chapters'>
    <div class='chapter-link'>Test title</div>
    <div class='chapter-link'>Test title</div>
    <div class='chapter-link'>Test title</div>
    <div class='chapter-link'>Test title</div>
  </div>
  <div class='btn'>&lt;</div>
</div>

0 个答案:

没有答案