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

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....