I have been looking for a way to vertical align content and text to the middle of the parent element(for example).
Most solutions found implied that I should make use of the
flex property or
vertical-align properties. It takes a couple of lines of code and the last named property would not function while taking use of divs. Also there were a couple of answers that suggested use of the
So my solution is simply to use the property
This should push the content in which the property is used within(as for example a div) with 10 pixels from the top of the parent element.
In case you wish to push it down more than that, try changing the number to a greater one. Or the other way around. The property can also use:
This will “push” content 10 pixels above the bottom of the element. Of course you could even use:
That will move the content 10 pixels from the left and 10 pixels from the right.