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!

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 Sass Basics (retired) Variables, Mixins, and Extending Selectors The Power of Mixins

Michael Lawinger
Michael Lawinger
33,581 Points

Mixin Problems

The question was: Write a new definition for the "button" mixin, which takes two arguments: $color and $size. The background should be set using the value in the $color variable, and the width should be set using the $size variable. The height should be half of the value in the $size variable.

My code is attached below

<!DOCTYPE html>
  <title>Sass Basics - Code Challenge</title>
  <link rel="stylesheet" type="text/css" href="page-style.css">
  <link rel="stylesheet" type="text/css" href="style.css">
  <h1>Hampton's Blog</h1>
  <a class="menu_button" href="#">
  <div class="entry">
    <h1>Great Music</h1>
      <div class="content">
            Here are some of my favorite bands from years past and present: Belle and Sebastian, Pixies, and Daft Punk. Listening to music allows me to focus when I'm programming. 
            <a href="#">Read More</a>
/* Write your SCSS code below. */
@mixin button($color, $size) {
background-color: $color;
width: $size;
height: $size /2;

1 Answer

Although they do almost the same effect, the challenge is expecting you to use the background property instead of the background-color property.

All you need to do is to change that property :grin:

Fixed version of your code:

@mixin button($color, $size) {
  background: $color;
  width: $size;
  height: $size / 2;

I hope this helps. :+1: