2017-06-22 7 views
1

私はこれらのニュースのブロックを持っていますが、私はをクリックしたときに「ショーより」宇宙は私がブロック間のスペースを削除するには?

デモ削除することはできませんブロックの間に表示されます:で sitelab.combr.co/repro.html

をこの瞬間

The space between the blocks

が、私はそれが動作するように望んでいたどのようにブロック間のスペース:他の下のブロックの間にスペースを入れず1ニュースのブロックが拡大した後も Without the spaces between the blocks one below the other even after the news block has expanded

コード

\t \t 
 
    $(document).ready(function(){ 
 

 
    var content = $('.card-text'); 
 
    var moretext = "Show more ❯"; 
 
    var lesstext = "Show less"; 
 

 

 
    content.each(function(){ 
 
      if ($(this).text().length > 83) { 
 
    
 
       $(this).addClass('truncate-ellipsis'); 
 
       $(this).after('<a href="" class="readmore-link">' + moretext + '</a>'); 
 
      } 
 
     
 

 

 
     }); 
 

 
    $('.readmore-link').on('click', function(b){ 
 
    b.preventDefault(); 
 
    if($(this).prev().hasClass("truncate-ellipsis")) { 
 
      $(this).prev().removeClass("truncate-ellipsis"); 
 
      $(this).html('Fechar'); 
 
      $(this).attr('class','readmore-link'); 
 
      
 
     } else{ 
 

 

 
      
 
      $(this).prev().addClass("truncate-ellipsis"); 
 
      $(this).html(moretext); 
 
      
 
     } 
 
     return false; 
 

 
    }); 
 

 

 

 

 
    });
\t \t 
 
.truncate-ellipsis{ 
 
display: block; 
 
display: -webkit-box; 
 
height: 60px; 
 
text-overflow: ellipsis; 
 
overflow: hidden; 
 
    -webkit-line-clamp: 3; 
 
    -webkit-box-orient: vertical; 
 
} 
 

 
.readmore-link{ 
 

 
    color:blue; 
 
}
<html lang="en"> 
 
<head> 
 
\t <meta charset="UTF-8"> 
 
\t <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> 
 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
 
      <!-- Rab Css --> 
 
     <link rel="stylesheet" href="http://sitelab.combr.co/css/style.css"/> 
 

 
</head> 
 
<body> 
 
\t <div class="container"> 
 
    <div class="row row-centered"> 
 
    
 
    <h1 class="title">News</h1> 
 
    <h2 class="subtitle">Lorem Ipsum is simply dummy text</h2> 
 
    
 
    
 
<div class="card-deck"> 
 
<div class="col-sm-6 col-md-4 col-lg-3 mt-4"> 
 
       <div class="card"> 
 
        <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
        <div class="card-block"> 
 
         <h4 class="card-title">CNN</h4> 
 
         <div class="meta"> 
 
          <a href="#">News1</a> 
 
         </div> 
 
         <div class="card-text">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a, posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
         </div> 
 
        </div> 
 
        
 
       </div> 
 
      </div> 
 
<div class="col-sm-6 col-md-4 col-lg-3 mt-4"> 
 
       <div class="card"> 
 
        <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
        <div class="card-block"> 
 
         <h4 class="card-title">CNN</h4> 
 
         <div class="meta"> 
 
          <a href="#">News 2</a> 
 
         </div> 
 
         <div class="card-text">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula ege</div> 
 
        </div> 
 
        
 
       </div> 
 
      </div> 
 
<div class="col-sm-6 col-md-4 col-lg-3 mt-4"> 
 
       <div class="card"> 
 
        <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
        <div class="card-block"> 
 
         <h4 class="card-title">BBC</h4> 
 
         <div class="meta"> 
 
          <a href="#">News 1</a> 
 
         </div> 
 
         <div class="card-text">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque. 
 
         </div> 
 
        </div> 
 
        
 
       </div> 
 
      </div> 
 

 
    <div class="col-sm-6 col-md-4 col-lg-3 mt-4"> 
 
       <div class="card"> 
 
        <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
        <div class="card-block"> 
 
         <h4 class="card-title">BBC</h4> 
 
         <div class="meta"> 
 
          <a href="#">News 1</a> 
 
         </div> 
 
         <div class="card-text">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque. 
 
         </div> 
 
        </div> 
 
        
 
       </div> 
 
      </div> 
 

 
    <div class="col-sm-6 col-md-4 col-lg-3 mt-4"> 
 
       <div class="card"> 
 
        <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
        <div class="card-block"> 
 
         <h4 class="card-title">BBC</h4> 
 
         <div class="meta"> 
 
          <a href="#">News 1</a> 
 
         </div> 
 
         <div class="card-text">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque. 
 
         </div> 
 
        </div> 
 
        
 
       </div> 
 
      </div> 
 

 
    <div class="col-sm-6 col-md-4 col-lg-3 mt-4"> 
 
       <div class="card"> 
 
        <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
        <div class="card-block"> 
 
         <h4 class="card-title">BBC</h4> 
 
         <div class="meta"> 
 
          <a href="#">News 1</a> 
 
         </div> 
 
         <div class="card-text">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque. 
 
         </div> 
 
        </div> 
 
        
 
       </div> 
 
      </div> 
 
     <div class="col-sm-6 col-md-4 col-lg-3 mt-4"> 
 
       <div class="card"> 
 
        <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
        <div class="card-block"> 
 
         <h4 class="card-title">BBC</h4> 
 
         <div class="meta"> 
 
          <a href="#">News 1</a> 
 
         </div> 
 
         <div class="card-text">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque. 
 
         </div> 
 
        </div> 
 
        
 
       </div> 
 
      </div> 
 

 
       <div class="col-sm-6 col-md-4 col-lg-3 mt-4"> 
 
       <div class="card"> 
 
        <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
        <div class="card-block"> 
 
         <h4 class="card-title">BBC</h4> 
 
         <div class="meta"> 
 
          <a href="#">News 1</a> 
 
         </div> 
 
         <div class="card-text">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque. 
 
         </div> 
 
        </div> 
 
        
 
       </div> 
 
      </div> 
 

 

 
</div> 
 
</div> 
 
</div> 
 

 
</body> 
 
</html>

+0

https://stackoverflow.com/q/34480760/3597276 –

答えて

0

実際には、それだけでrelative位置し、ブートストラップが使用するfloatシステムとの振舞にあなたの願いを取得することは不可能です。新しいブロックラインの位置は、前の高さラインに対して相対的に設定されるためです。したがって、行の要素の高さを増やすと、次の要素の高さはすべて下がります。

最初の解決策は、card-deckクラスの列レイアウトを使用することです。しかし、それはあなたのカードが自動的に並んで配置されないことを意味します。それらのいくつかは他のものの上に配置され、列で並べ替えられます。以下は、他の要素よりも背が高い#test divで作成した例です。あなたが見ることができるように(スニペットフルページモードで)、#test divの下にある要素が下に移動しました。あなたが使用することができます

.card-deck { 
 
    column-width: 300px; 
 
column-gap: 10px; 
 
width: 90%; 
 
max-width: 100%; 
 
margin: 50px auto; 
 
} 
 

 
.card { 
 
    border: 2px solid grey; 
 
    margin: 0 2px 15px; 
 
    padding: 10px; 
 
    padding-bottom: 10px; 
 
    background: #fcfcfc; 
 
    display: inline-block; 
 
} 
 

 
#test { 
 
    height: 500px; 
 
} 
 

 
.card-img-top { 
 
    width: 100%; 
 
} 
 

 
.card-block { 
 
    padding: 1.25rem; 
 
}
<div class="card-deck"> 
 
     <div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
     <div class="card" id="test"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
     <div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 

 
     <div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
     <div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
     <div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
     <div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
     <div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
     <div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
     <div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
     <div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
     <div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
     <div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
<div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
<div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
<div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
<div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
<div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
<div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
<div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
<div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 
<div class="card"> 
 
     <img class="card-img-top" src="http://www.sky-valley-web-design.com/images/250x150.gif"> 
 
     <div class="card-block"> 
 
      <h4 class="card-title">CNN</h4> 
 
      <div class="meta"> 
 
      <a href="#">News1</a> 
 
      </div> 
 
      <div class="card-text truncate-ellipsis">Morbi a metus. Phasellus enim erat, vestibulum vel, aliquam a , posuere eu, velit. Nullam sapien sem, ornare ac, nonummy non, lobortis a, enim. Nunc tincidunt ante vitae massa. Duis ante 
 
      </div><a href="" class="readmore-link">Show more ❯</a> 
 
     </div> 
 

 
     </div> 
 

 
    </div>

別の解決策は、絶対的に要素の位置を設定することです。 Masonryのようなグリッドレイアウトライブラリを使用するとよいでしょう。

MasonryはJavaScriptグリッドレイアウトライブラリです。これは、利用可能な垂直方向のスペース、壁の石工フィッティング石のような一種の に基づいて最適な位置に 要素を配置することで動作します。あなたはおそらくそれをインターネット上の で見ました。

+0

なぜ、あなたは 'display:flex'を使わないと' flex:1 1 auto; 'を使っていますか? ... 'flex:1 1 auto;'はそれなしの要素には何の影響も与えません。 – LGSon

+0

はい! :) 仰るとおりです。それは私の間違いです。私はこの問題を解決するために私が試している間に書いたこのコードを消去するのを忘れていました。私はそれを見ていなかった。ご報告いただきありがとうございます。ご迷惑をおかけしまして、回答を更新します。あなたが言ったように、それらのプロパティは役に立たないので、私が到達したエフェットは、それらなしではまだ動作します –

関連する問題