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

CSS

Resizing jpg in header - pic too big!

I need your help, please. I've added a jpg image to my header but it's way too big. It won't scale my beautiful image.

I've walked myself through the CSS tutorials and coding for the header and just can't figure out how to shrink the image to make it fit perfectly in the header. Here's my code:

<=== HTML version ===>

<header class="mountain"></header>

<=== CSS version ===>

.mountain { background:url(header_pict.png); background-position:center; background-repeat:no-repeat; height:260px; background-size: cover; width:100%; border-top: 5px solid white; border-bottom: 1px solid black; }

Mysteriously, it screws up when I use the internal html coding system - like this for example:
<img src="header_pict.png" height="250" width="100%"></header>.

Your help is greatly appreciated.

Laura

1 Answer

Hi laura,

i've opened your syntax in codepen and grabbed a random image from google images to check it out. It seems to be working ok on my side. Heres the link to codepen: http://codepen.io/pavCieslak/pen/DrfJl