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
Jesse Box
5,068 PointsResponsive Images that Animate using CSS
Hello Treehouse Go'ers
I'm in the planning stages of designing a website for myself. I've taken many classes and I still have a couple of questions regarding two main mechanics of my website.
First Mechanic Issue: The desired effect I want is the background of my page to animate with multiple images that span full screen using a ease-in transition effect. I've read that its not possible to animate a background property, Is this true? If so what would be the next best way to achieve what I want.
Second Mechanic Issue: Making those fullscreen images responsive... I'm going to approach my website from a 'mobile first' perspective so this is really key for me. I'm a novice at Javascript but if theres a solution out there that involves some jquery magic then I fill endeavour to learn. I would be super keen to know if theres a CSS solution to this problem as well since I'm much more advanced with CSS.
Many Thanks in advance
1 Answer
John Locke
15,479 PointsHi Jesse:
Instead of making the background itself animate, try putting a full-width div with your images right above your background layer. Making images responsive starts with adding { max-width: 100%; } You can add {width: 100%: } and your width will change with the browser.
If you have a background image, the idea is basically the same. On your <body> or other containing div, add { background-image: url(yourpath.png) no-repeat center center; background-size: cover; }
These are just places to start. Without knowing the specific effect you are going for, it's difficult to recommend the next step. Most everything that can be done has a tutorial somewhere.