div的填充被列布局破坏

时间:2018-09-15 14:55:08

标签: html css css3 layout

当我创建喜欢pinterest的布局时,我使用列。但是我不控制专栏。

该列中断了div的填充部分。

问题是 #1

我发现,当最长的div比另一个div长时,就会发生此错误。 #2

我使用开发工具,但无法解决此问题。由于#3

在开发工具中,布局看起来没有问题。但是我不知道为什么填充部分移到了下一列。#4 这是我的布局源代码。

.card {
  break-inside: avoid;
  width: 15rem;
  height: max-content;
  margin: 10px;
  background-color: white;
  border: 1px solid var(--oc-gray-3);
  border-radius: 10px;
  align-items: center;
  box-shadow: 0 3px 5px 0 rgba(0, 0, 0, 0.15);
  transition: all .4s ease-in-out;
}

.card-container {
  break-inside: avoid;
  column-count: 10;
  column-gap: 1rem;
  column-width: 16rem;
  width: max-content;
  max-height: max-content;
  height: 100%;
  max-width: 96vw;
}
.card-title {
  padding: 10px;  
  font-size: 1.2rem;
  word-break: break-word;
  text-align: center;
}

.card-link {
  display: block;
  padding: 10px;
  word-break: keep-all;
  overflow-x: hidden;
} 
@media screen and (max-width: 700px) {
  footer {
  display: block;
  z-index: 1000;
  background-color: white;
  height: 56px;
  }

  article {
    margin-bottom: 10px;
    padding: 10px;
    height: calc(100vh - 140px);
    overflow-y: scroll;
    overflow-x: hidden;
    justify-content: center;
    display: flex;
  }
}

@media screen and (min-width: 700px) {

  footer {
    display: none !important;
    height: 0;
  }

  article {
    margin-bottom: 10px;
    padding: 30px;
    height: 100vh;
    overflow-y: scroll;
    overflow-x: hidden;
    justify-content: center;
    display: flex;
  }
}
.card-link button, .destination {
  background-position: center;
  transition: background 0.8s;
}

.card-link {
  background-position: center;
  transition: background 0.3s;
}

.card-link:last-child:hover, .card-link:last-child, .card-link:last-child:active {
  transition: none;
  background: white;
}



<article>
  <div class="card-container">
    <div class="card" v-for="group in groups" :key="group.id">
      <div class="card-title">
        <span class="title">Lorem ipsum</span>
      </div>
      <div class="card-list">
        <div class="card-link" v-for="link in group.list" :key="link.title">
          <a class="link" :href="link.url">Lorem ipsum</a>
        </div>
        <div class="card-link"
             style="border-top:1px solid #f1f3f5;align-items: center;display:flex;padding: 10px;border-bottom-left-radius: 10px;border-bottom-right-radius: 10px;">
          <button><i class="material-icons red6">
            favorite
          </i></button>
          <button @click="copyURL(group.id)"><img src="../assets/icon/copy.svg" alt="copy"></button>
          <button><img src="../assets/icon/share.svg" alt="share"></button>
          <button><img src="../assets/icon/more.svg" alt="more"></button>
        </div>
      </div>
    </div>
  </div>
</article>

0 个答案:

没有答案