html - Centering text/content under images in flexbox? -


i've been attempting add paragraph text under vertically aligned image in flexbox, have been getting trouble getting render onto next line. possible text centered under image?

here have: jsfiddle

html:

<section class="landing">   <div class="left-half">     <article>       <img src="http://placehold.it/400x600" />       <div class="text">         <p>i need text under image</p>       </div>     </article>   </div> </section> 

css:

.landing {   display: flex; }  .left-half {   flex: 1;   height: 100vh; }  .left-half article {   height: 100%;   width: 100%;   display: flex;   align-items: center;   justify-content: center; }  .left-half article img {   max-width: 50%;   display: block; }  .caption {   display: block; } 

just set .left-half article flex-direction:column;:

.left-half article {     height: 100%;     width: 100%;     display: flex;     align-items: center;     justify-content: center;     flex-direction:column; } 

jsfiddle demo


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo