Quantcast
Channel: Active questions tagged flexbox - Stack Overflow
Viewing all articles
Browse latest Browse all 1675

How to vertically align text inside element which is a flex item [duplicate]

$
0
0

I have the following layout:

<style>    div {        display: flex;        flex-direction: column;        height: 300px;        width: 300px;        align-items: stretch;    }    p {        flex-grow: 1;        text-align: center;        background-color: aqua;    }</style><div><p>blah</p></div>

Is there a way to center the <p>'s text vertically? I've tried with display: table-cellvertical-align: middle but it didnt work. Any ideas?


Viewing all articles
Browse latest Browse all 1675

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>