

It works straight out of the box, even in Internet Explorer 9! It is a similar technique to the absolute-position method, but with the upside that we don’t have to set any height on the element or position-property on the parent. Usually this must be done with absolute positioning or setting line-heights, but these require you to either know the height of the element or only works on single-line text, etc. The CSS property transform is usually used for rotating and scaling elements, but with its translateY function we can now vertically align elements. With just three lines of CSS (excluding vendor prefixes) we can do it with the help of a transform: translateY vertically centers whatever we want, even if we don’t know its height. By reading the above article I also created a demo fiddle. All credit goes to this link owner Ekström Link please go through this.
