html-css

Vertical alignment or centered vertically using DIV

I have always encountered the problem of vertically align a div to avoid having to be modifying the paddingwhen the text size is too long and takes up two rows … well here I leave the point of how to make thisautomatic alignment as it we do when we use a table and it is through css

.contenedor{display:table;height:500px}
.contenido-a-centrar{display:table-cell;vertical-align:middle;}

<div class="contenedor">
<div class="contenido-a-centrar">
TEXT THAT ALWAYS GIVES PROBLEMS AND WANT VERTICAL CENTER
</div>
</div>