Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

Img 100% height

Morning All

I want to create a full height image of a Div - I am using 100% height on html and body etc and this creates 100% height of the viewport but what I am looking for is 100% height of the browser window. As if I open the attached site with Dev tools open it all goes a bit wrong.

http://www.justg.co.uk/b5/

2 Answers

May be... .colTwo img { width: auto; height: 100%; background-size: cover; }

Pretty sure it has to be a background image for that to work.

.colTwo { background: url('img/mainImage.jpg') 0 0 no-repeat; background-size: cover; }

This is the easiest solution I think.