26 March 2017

Tweaking the vertical position of an image

Positioning images/icons alongside text or other elements can be tricky. The following CSS will allow you to slide the image along the vertical axis.

.something img {
    position:relative;
    top:50%;
    transform:translateY(-35%); /* play with this */
}

No comments:

Post a Comment