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
Stu Cowley
26,287 PointsCSS Layout Basics Question: Making the Banner an Image. How do I do this?
Hi everyone,
I have just completed the CSS Layout Baics with Guil Hernandez. Learnt so much in this course, another information rich course!
I decided I would borrow the layout that we created. But I want to be able to add a background image to the banner instead of using a solid color. I have been playing around but I cannot seem to get it to work without breaking the layout on smaller devices.
Here's the code I have been using:
.banner {
color: #fff;
background: no-repeat center/100% url('../img/banner-bg.jpg) #00cfcc;
padding: 12em 0;
margin-bottom: 60px;
}
I have been fiddling around with this all day but I cannot get the image to display nicely on smaller screens.
Any advice on how I can fix this would be greatly appreciated!
Stu :)
1 Answer
Cena Mayo
55,236 PointsHi Stu,
Often mobile-first design dictates simply dropping a large image altogether ini favor of small-screen readability/usability. Barring that, have you checked out the course Responsive Images? That might help point you in the right direction.
Best, Cena
Stu Cowley
26,287 PointsStu Cowley
26,287 PointsThanks for that Cena,
I must've missed that one, Treehouse is releasing so much content it starting to get difficult keeping track of what's what. I'll do the course and hopefully I find my answer!
Stu :)