2017-02-14 41 views
0

http://www.bootply.com/brOEODSopK#砌體引導欄(4)不是所有的使用,除非最小的6個項目存在

當運行在bootply這個代碼,似乎一切都運行完美。如果您將推薦量降低到5或更少,所有數據將被推入第1和第2列,忽略第3和第4列,直到存在6個或更多推薦。有沒有可能解決這個問題?如果我有3個推薦,它應該分佈在3列。如果我有4個,應該在整個4

蔓延請告知

+0

你是新來引導? –

+0

去年我一直在使用它。所以,我猜想有點新。 – Ginjo

+0

看看這似乎是好的:http://codepen.io/Sky-123/pen/XpGWNX –

回答

0

CODE:http://codepen.io/Sky-123/pen/XpGWNX

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 

<!-- jQuery library --> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 

<!-- Latest compiled JavaScript --> 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 


<div class="container testimonials-parent"> 
    <h1>Masonry CSS with Bootstrap</h1> 
    <div class="row"> 
      <div class="item col-md-4 col-lg-4"> 
       <blockquote> 
        <p>Fun : My son enjoys it. It did surprise me when it went from adding to 「less than」 and 「greater than.」</p> 
        <footer>Dayna from United States about GS Kids! Preschool Numbers (Windows Store) on Sep 29, 2014</footer> 
       </blockquote> 
      </div> 
      <div class="item col-md-4 col-lg-4"> 
       <blockquote> 
        <p>Happy daughter and happy parents : Not glitchy, very encouraging for children, rewarding, entertaining, and best of all its educational. My daughter is transitioning between pre-k skills to kindergarten and this as well as other GS apps seem perfect. Will be upgrading.</p> 
        <footer>Robertson from United States about GS Kids! Preschool Numbers (Windows Store) on Sep 09, 2014</footer> 
       </blockquote> 
      </div> 
      <div class="item col-md-4 col-lg-4"> 
       <blockquote> 
        <p>Wow app : Great app for kids to learn and fancy their imagination.</p> 
        <footer>Ramanjit from India about GS Kids Paint &amp; Learn (Windows Store) on July 19, 2014</footer> 
       </blockquote> 
      </div> 
     </div> 
    <div class="row"> 
      <div class="item col-md-4"> 
       <blockquote> 
        <p>Love : we love coloring. Its great for us!!!</p> 
        <footer>Alfredo from United States about GS Kids Paint &amp; Learn (Windows Store) on Feb 05, 2014</footer> 
       </blockquote> 
      </div> 
      <div class="item col-md-4"> 
       <blockquote> 
        <p>My girls’ go to game : This is the app my 3yo picks every time she’s allowed on my computer. Sometimes the 「crayon」 will get stuck, but overall, it’s been a great app for her and her big sisters.</p> 
        <footer>Sandy from United States about GS Kids Paint &amp; Learn (Windows Store) on Feb 14, 2014</footer> 
       </blockquote> 
      </div> 
      <div class="item col-md-4"> 
       <blockquote> 
        <p>Good for learning Alphabets : My son is enjoying painting and learning Alphabets.</p> 
        <footer>Sulabha from India about GS Kids Paint &amp; Learn (Windows Store) on July 29, 2014</footer> 
       </blockquote> 
      </div> 
    </div> 

</div> 



testimonials-parent, *:before, *:after {box-sizing: border-box !important;} 


.testimonials-parent .row { 

-moz-column-gap: 1em;/* Firefox */ 
-webkit-column-gap:1em;/* Chrome, Safari, Opera */ 
column-gap:1em; 
} 



blockquote { 
    border-left: none; 
    margin: 0; 
    margin-bottom: 0.5em; 
    background-color: #00cccc; 
} 

blockquote p{ 
    color: #fff; 
    font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    font-style:oblique; 
    font-size: 1.125em; 
} 

blockquote footer{ 
    font-family: 'Helvetica Neue', Helvetica, sans-serif; 
    font-size: 0.875em; 
} 

blockquote p:before { 
    content: "\f10d"; 
    font-family: 'Fontawesome'; 
    float: left; 
    margin-right: 10px; 
} 
+0

Aakash Thakur提出了相同的解決方案,但這不能解決問題,因爲它創造了一個新的。數據可能會有所不同,因爲它來自數據庫。所以有時我們可能有1條記錄或多達50條。這些項目應該在各自的列中彼此疊置。使用上面的代碼,其基本上是硬編碼的每一行。這妨礙了正確堆疊的能力​​。 – Ginjo