2016-06-09 7 views
0

Ich habe die folgenden HTML und CSS und ich bin ein bisschen verwirrt als die beste Möglichkeit, sie in ein Raster "zu sperren" - So sehen sie alle ausgerichtet 5 über was auch immer aus. Ich nehme zur Kenntnis, dass die <li> eine eingestellte Höhe von 180pxImage Grid Ausrichtung

JS Fiddle

Aktuell Ergebnis hat:

enter image description here

HTML:

<div class="sponsors"> 
     <p>Pretty amazing huh. These prize packs were only made possible because of the support of our amazing sponsors.</p> 

     <hr> 

     <ul class="sponsors list"> 
      <li><a href="http://butterflycreek.co.nz/"><img src="http://dev.jzm.co.nz/turtle/web/images/sponsors/butterfly-creek.png" alt="Butterfly Creek"></a></li> 
      <li><a href="http://www.tinyturtles.co.nz"><img src="http://dev.jzm.co.nz/turtle/web/images/sponsors/tiny-turtles.png" alt="Tiny Turtles"></a></li> 
      <li><a href="http://www.theparentingplace.com/"><img src="http://dev.jzm.co.nz/turtle/web/images/sponsors/parenting-place.png" alt="The Parenting Place"></a></li> 
      <li><a href="http://www.yates.co.nz/"><img src="http://dev.jzm.co.nz/turtle/web/images/sponsors/yates.png" alt="Yates"></a></li> 
      <li><a href="http://www.myfoodbag.co.nz/"><img src="http://dev.jzm.co.nz/turtle/web/images/sponsors/my-food-bag.png" alt="My Food Bag"></a></li> 
      <li><a href="http://www.avalanchecoffee.co.nz/"><img src="http://dev.jzm.co.nz/turtle/web/images/sponsors/avalanche.png" alt="Avalanche"></a></li> 
      <li><a href="http://www.ohbaby.co.nz/"><img src="http://dev.jzm.co.nz/turtle/web/images/sponsors/ohbaby.png" alt="OhBaby"></a></li> 
      <li><a href="http://getrealfood.co.nz/"><img style="margin-top:128px" src="http://dev.jzm.co.nz/turtle/web/images/sponsors/get-real-food-logo.png" alt="Get Real Food"></a></li> 
      <li><a href="http://littlebopeeps.co.nz/"><img style="margin-top:128px" src="http://dev.jzm.co.nz/turtle/web/images/sponsors/Logo_Little-Bo-Peeps-Logo.png" alt="Little Bo Peeps"></a></li> 
      <li><a href="http://karawoskett.co.nz/"><img style="margin-top:128px" src="http://dev.jzm.co.nz/turtle/web/images/sponsors/Kara-Woskett-Portraits-Logo.png" alt="Kara Woskett Portraits"></a></li> 

     </ul> 


    </div> 

CSS:

.sponsors:not(.list) { 
    margin-bottom: -100px; 
    padding: 50px 0; 
    background: #fff; 
} 

.list.sponsors { 
    display: flex; 
    flex-flow: row wrap; 
    justify-content: center; 
    align-items: center; 
    margin: 0 auto; 
    width: 1150px; 
} 
.list.sponsors li { 
    display: inherit; 
    flex: 1 0 200px; 
    justify-content: center; 
    align-items: center; 
    height: 180px; 
    transform: translateY(45%); 
} 
.list.sponsors img { 
    max-width: 100%; 
} 
+0

warum in einigen Bildern margin-top verwenden –

Antwort

1

versuchen, diese

css

.sponsors:not(.list) { 
    margin-bottom: -100px; 
    padding: 50px 0; 
    background: #fff; 
} 

.list.sponsors { 
    display: flex; 
    flex-flow: row wrap; 
    justify-content: center; 
    align-items: center; 
    margin: 0 auto; 
    width: 1150px; 
} 
.list.sponsors li { 
    display: inline-block; 
    /* flex: 1 0 200px;*/ 
    justify-content: center; 
    align-items: center; 
    /* height: 180px;*/ 
    transform: translateY(45%); 
    vertical-align:middle; 
    width:200px; 
    height:200px; 
    background-color:gray; 
    margin:10px; 
} 
.list.sponsors img { 
    max-width: 100%; 
} 

demo