charliesneath
charliesneath

Reputation: 2039

Align text to the baseline of another element's first line of text

Is it possible to align the text of one elements to the first line of text of another?

Both elements are variable length, so they might be more than one line.

Upvotes: 3

Views: 1228

Answers (1)

durchgemacht
durchgemacht

Reputation: 118

Yes, it's possible. You should get familiar with flexbox. The css property you are looking for is

align-items: baseline

Here you will find a great overview on flexbox in general: https://css-tricks.com/snippets/css/a-guide-to-flexbox/

I've build a quick example on codepen: http://codepen.io/durchgemacht/pen/EjVXEW?editors=110

Upvotes: 2

Related Questions