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 trialKeith Carrillo
6,909 PointsWhy does Miguel set the panel-default twice?I didn't get his explanation.
Why does Miguel set the panel-default twice?I didn't get his explanation.
2 Answers
jlampstack
23,932 PointsGuil is short for Miguel? I always assumed it was short for Guillermo?
LOL
Tomasz Denkiewicz
11,778 PointsRepeating %panel-deaflut placeholder in centered modifier class prevent from having to define both class .panel and .panel-centered in HTML
So we can do this:
<header class="panel--centered" role="banner">
instead of that:
<header class="panel panel--centered" role="banner">
bill curry
Front End Web Development Techdegree Student 7,841 Pointsbill curry
Front End Web Development Techdegree Student 7,841 PointsHi, I know this question is old, but I had the same one, so here's my answer for anyone else who's scratching their head. This one kinda threw me.
In the markup above, we create the .panel class. We then extend the %panel-default placeholder as a base style for the panel item (line2).
We then create the 2 modifier mixins:
1) m(centered), to provide centering to the default style. We have to re-state the %panel-default placeholder in order to modify it (this answers keith's question, i hope); and
2) m(padded), which provides extra padding and also the option of centering, if desired. Note how the centered option of the second mixin also has to restate %panel-padding in order to modify it.
This gives us four options in our html:
1)header class="panel" (This provides the default padding and is aligned left -- no centering); see line 2
2)header class="panel--centered" (This provides the default padding and is centered); see line 4
3)header class="panel--padded" (This provides the extra padding and is aligned left--no centering) line 9
4)header class="panel--padded--centered" (This provides the extra padding and is also centered). line 11
One note: the fourth option has to be stated in that order; panel--centered--padded doesn't work
Hope this helps.