Flex Column Containers With Bump Outs

by Ian Roberts

HTML

<!-- current issue, padding pushes text & image divs outside of their flex container -->
<div class="component shift-up">
  <div class="container">
    <div class="flexbox-container">
      <div class="text">
        <h3>Column 1</h3>
        <p>Paragraph text is awesome. This is the best thing I have heard of since sliced bread. I should use the internet more.</p>
      </div>
      <div class="image">
        <img src="https://placehold.it/300x500">
      </div>
    </div>
  </div>
</div>

CSS

body {
  background-color:rgba(255,0,0,1);
  padding:0;
  margin:0;
}
.component {
  background-color:green;
}
.flexbox-container {
  background-color:rgba(50,12,99,.5);
}
div {
  background-color:rgba(50,12,99,.5);
}
.flexbox-container > div {
	border:1px solid rgba(0,0,255,.5);
}

.component {
  width:100%;
  height:100%;
  margin-top:60px;
  margin-bottom:60px;
}
.container {
  max-width:400px;
  width:100%;
  position:relative;
  margin:0 auto;
}
.flexbox-container {
  position:relative;
	display: -ms-flex;
	display: -webkit-flex;
	display: flex;
  align-items: center;
  justify-content: center;
}

.flexbox-container > div {
  min-width: 50%;
}
.text {
  z-index:1;
  padding-top:60px;
  padding-bottom:60px;
  padding-left:10px;
  padding-right:10px;
}
.image {
  z-index:0;
	display: flex;
  justify-content: flex-end;
  padding-left:20px; /*gotcha this needs to match padding-left plus padding right of .text to get columns even again*/
}
/*modifiers*/
.shift-up .image {
  transform:translateY(-50px);
  margin-bottom:-50px;  
}
.shift-down .image {
  transform:translateY(50px);
  margin-top:-50px;  
}