Below is the code to align any element in center or a div element, vertically and horizontally both in responsive layout.
Apply below CSS to the element that needs to be centered in a div:
position:fixed; top:50%;
right:50%;
transform:translateY(-50%);
-webkit-transform:translateY(-50%); /* for chrome preview */
height: auto;
width: auto;
padding: 0;
margin:0;