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
KP Cluff
2,344 PointsAdd CSS that will allow all images to fill their parent element.
I need to add that type of CSS but where do i add it? Help Please.
1 Answer
myackley35
34,574 PointsHey KP!
You can also use:
img {max-width: 100%;}
In the future if you decide to start getting into responsive web design using this property will help your images be more fluid.
dnogmdehbp
Courses Plus Student 726 Pointsmax-width:;
will do a lot of nice things when you are on the responsive tour!
Kayla Davis
4,668 PointsKayla Davis
4,668 PointsYou can add this CSS in a separate CSS file linked to your HTML, by using the code:
img { width: 100%; }
This code should allow the image defined by and <img> tag to fill it's parent element. You could also use the inherit property, too,
http://www.w3schools.com/cssref/pr_dim_width.asp
Hope this helps!