DEV Community

Discussion on: 4 Things I Learned From Building My First Site Solo

clairemuller profile image
Claire Muller Author

I was originally setting the line-height equal to height, but if the text is too long and wraps to the next line, it creates a huge space between the two lines. :(

yaser profile image
Yaser Al-Najjar

Ah, line-height is for one line text... here the multi-line way:

It's like converting this paragraph into a table (using display), so that we can use vertical-align

    p {
        background-color: red;
        width: 150px;
        height: 150px;
        display: table-cell;
        vertical-align: middle;

<p>whatever stuff right here to go to the next line</p>