Live data from Hacker News

Aligning Text Smartly in CSS

nocode.in

1–10 of 30 posts

Re: Aligning Text Smartly in CSS

#2
This is very cool. For those who didn't get it, here's how it works.

Initially, when figcaption text is short, it behaves something like this:

  |         |

  |    |

  ||
The text inside the figcaption element is always aligned left but the element itself is centered. When the text is longer, figcaption grows to a 100% width while the text is still aligned left.

Re: Aligning Text Smartly in CSS

#4
post #2

This is very cool. For those who didn't get it, here's how it works. Initially, when figcaption text is short, it behaves something like this: | | | | | | The text inside the figcaption element is always aligned left but the element itself is centered. When the text is longer, figcaption grows to a 100% width while the text is still aligned left.

Thank you, your explanation was a lot clearer than the one in the article which I found hard to read. I think it would have been much more clear if they had shown the markup for the content.

Re: Aligning Text Smartly in CSS

#5
Technically very cool, but as a designer, I wouldn't want captions to behave like that. Center all, or left align all. Or if there really is a difference between short caption and longer description, differentiate also typographically, by changing font size, style and line height.

Re: Aligning Text Smartly in CSS

#8
post #4
post #2

This is very cool. For those who didn't get it, here's how it works. Initially, when figcaption text is short, it behaves something like this: | | | | | | The text inside the figcaption element is always aligned left but the element itself is centered. When the text is longer, figcaption grows to a 100% width while the text is still aligned left.

Thank you, your explanation was a lot clearer than the one in the article which I found hard to read. I think it would have been much more clear if they had shown the markup for the content.

Yes, I had to fiddle with the codepen example[1] to understand it correctly.

1: http://codepen.io/usablecode/pen/EjERem

Re: Aligning Text Smartly in CSS

#9
post #6

Damn. The front page of HN for this ? Oh, the Erlang days of glory past, I yearn you so much.

On the contrary, I found this interesting. As someone who doesn't do CSS as part my day job, these still loads of clever CSS tricks/methods I'm totally unaware of.
Post reply on HN