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 Modular CSS with Sass Getting Modular with Mixins and Functions Background Image Mixin

Adjusting Background Size Image according to Height of HTML Element Via Sass

I'd like to create the same mixin as Guil Hernandez created in this video but I would want to make it even more modular by having the background size in the img-replace mixin to adjust it's background-size (height) according to the height of the html element (for example line-height of h2).

Whats the approach to achieving this?

1 Answer

You should look into adding the default height in the mixin to auto.

here is a very good breakdown of height 100% vs height auto;

height