Vertically align text inside anchor

css, html

Solution

You could do this using `.my-a-class { line-height: value }`. Replace `value` with the height of your image.

Edit ---

These days it is much better to use flexbox for this:

.my-a-class {
   display: flex;
   align-items: center;
   justify-content: space-between;
}

Problem

I have this piece of HTML: ``` <a href="href" class="my-a-class> <img alt="alt" src="/path/to/image.jpg" class="my-img-class" />&nbsp;My text </a> ``` I need to vertically align "My text" without affecting the image in the anchor. I can't add any HTML tag, I need to do this only with CSS. Any suggestion?

Original source