css - Move single element to the end of a flex container -


i thought i'd able shift single button end of flex-box.

i have set parent display: flex; , thought i'd able target 1 element , pin bottom of container align-self: flex-end;

it doesn't work. here pen: my codepen illustrating issue

 <div class="row services">   <div class="small-3 panel columns service">     <i class="fa fa-thumbs-o-up"></i>     <h3>suspendisse</h3><p>lorem ipsum dolor sit amet, consectetur adipisicing elit. a, ad?</p>     <div class="button">read more</div>   </div>   <div class="small-3 panel columns service">     <i class="fa fa-key"></i>     <h3>maecenas</h3><p>porro quibusdam nostrum eaque, quasi laudantium delectus quaerat cumque, quos.</p>     <div class="button">read more</div>   </div>   <div class="small-3 panel columns service">     <i class="fa fa-flag"></i>     <h3>aliquam</h3><p>iste architecto omnis, esse facere quod ratione, officia veritatis fugit.</p>     <div class="button">read more</div>   </div>   <div class="small-3 panel columns service">     <i class="fa fa-flask"></i>     <h3>habitasse</h3><p>ducimus voluptates assumenda, illum adipisci sed quaerat est ipsum nisi.</p>     <div class="button">read more</div>   </div> </div>  .services {   display: flex;  } .service {   flex-direction: column; } .button {   align-self: flex-end; } 

align-self work direct child elements of flex parent, so:

  • make .service flex parent display: flex , set flex-wrap: wrap

  • center button margin: 0 auto

working example

also available codepen.

.services {    display: flex;  }  .service {    display: flex;    flex-wrap: wrap;  }  .button {    align-self: flex-end;    margin: 0 auto !important;     /* !important used example override foundation.css*/  }
<link href="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.1/css/foundation.min.css" rel="stylesheet"/>    <div class="row services">    <div class="small-3 panel columns service">      <i class="fa fa-thumbs-o-up"></i>      <h3>suspendisse</h3><p>lorem ipsum dolor sit amet, consectetur adipisicing elit. a, ad?</p>      <div class="button">read more</div>    </div>    <div class="small-3 panel columns service">      <i class="fa fa-key"></i>      <h3>maecenas</h3><p>porro quibusdam nostrum eaque, quasi laudantium delectus quaerat cumque, quos.</p>      <div class="button">read more</div>    </div>    <div class="small-3 panel columns service">      <i class="fa fa-flag"></i>      <h3>aliquam</h3><p>iste architecto omnis, esse facere quod ratione, officia veritatis fugit.</p>      <div class="button">read more</div>    </div>    <div class="small-3 panel columns service">      <i class="fa fa-flask"></i>      <h3>habitasse</h3><p>ducimus voluptates assumenda, illum adipisci sed quaerat est ipsum nisi.</p>      <div class="button">read more</div>    </div>  </div>


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -