PublicExpiration: 2 days from now I finally figured out how to vertically align text next to icons... etctextcsstech

I thought my alignment problems came from the images, but they actually came from the text!

In this example, the SVG will be centered, but since the text doesn't have its own container node that CSS can target (not even an implicit one), it'll stay in the default location:

<div>
  <svg class="align-middle" />
  Some text
</div>

If you put the text into a container, you can center it alongside the icon:

<div>
  <svg class="align-middle" />
  <span class="align-middle">Some text</span>
</div>

No flexbox needed.

SulkiesFellatio 27 days ago

all of the times i've needed to vertically align something and got stack overflow and other bullshit responses about using flex and all these other things, and for inline elements there's just a single magic property. your the man now dog

View