I'm labeling photos with captions and I'd like to center the text if the text does not span more than one line. However, on captions that span more than one line, I'd like to left justify (text-align:left).

Is this remotely possible with css3 or script?