Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS

Layout break

So I am working on a little ui-kit and I've made alerts and for some odd reason they stretch their parent container.

You can see the layout here http://johnweland.github.io/cltsd/

if you dismiss the alert in the side bar you can see the sidebar container shrink to the width its supposed to be. You can find the code here. https://github.com/johnweland/cltsd

But for example my alerts sass is as follows.

.alert {
  max-width: 100%;
  padding-left: 0.857em; // distance to match that of .alert__trigger.
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.alert__trigger {
  align-self: flex-start;
  width: 40px;
  min-height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
}

@each $theme, $color in $ui-colors {
  .alert--#{$theme} {
    background-color: $color;
    color: $white;
  }
}

I've done some more testing and text seems to push my flex boxes wider instead of said text breaking and wrapping.

update ::

[class^="site-"] {
  margin: .3em;
  flex-basis: 0; // Fixes odd layout issue... Hack?
  flex-grow: 1;
}

setting flex-basis to 0 seems ot fix the issue, though I'm not sure if that is a hack or proper coding....