Left-justifying text under image with max-width:100%

kosh

New Member
I'd like the text under this image to be left justified under the image ('my title' to be aligned with the left side of the image), no matter what it's height, without Javascript.HTML\[code\]<div class="container"> <div class="img-container"> <img src="http://img.thesun.co.uk/multimedia/archive/01572/empire-state-build_1572000a.jpg"/> <div class="info"> <h1>my title</h1> <p> my description</p> </div> </div></div>\[/code\]CSS\[code\].container{ width:900px; position:relative;}.img-container{ text-align:center;}img{ max-width:100%;}.info{ text-align:left;}\[/code\]http://jsfiddle.net/NGwdc/If you adjust .container width, it should always be aligned to the left side of that image.Is this possible with only CSS?
 
Back
Top