0

I have been tasked with developing 2 divs, the bottom div must have a border all the way around it, and have the top right corner notched out. The top div must also contain a border, and the bottom right corner of the div should be the inverse of a notched corner. Please see the image below to show exactly what it is I am trying trying to accomplish. This is difficult to explain. :-/

enter image description here

Harry
  • 87,580
  • 25
  • 202
  • 214
  • 1
    For one half you can refer to this - http://stackoverflow.com/questions/19248443/is-it-possible-to-create-an-angled-corner-in-css/30729446#30729446, for the other you can take ideas from here - http://stackoverflow.com/questions/30011363/transparent-shape-with-arrow-in-upper-corner/30011454#30011454 – Harry Jun 08 '16 at 16:49

1 Answers1

0

I would do this via linear-gradient , transparent border, background-clip, and box-shadow :)

div {
  width: 800px;
  max-width: 90%;
  margin: 2em auto -3.5em;
  padding: 0 2em 0 1em;
  background: white;
  position: relative;
  box-shadow: inset -3px 0 turquoise, inset 0 -3px turquoise, inset 3px 0 turquoise;
  border-top: 3em solid transparent;
  border-bottom: 2em solid transparent;
  background-clip: padding-box;
}
div:first-of-type {
  border-top:solid turquoise;
  padding-top:2em;
  }
div:first-of-type:before {
  display:none;
  }
div:before,
div:after {
  content: '';
  position: absolute;
  right: 0;
}
div:before {
  height: 2.7em;
  width: 100%;
  top: -2.7em;
  box-shadow: inset 3px 0 turquoise;
  background: linear-gradient(turquoise, turquoise) 0 0 no-repeat, linear-gradient(-135deg, transparent calc(2em - 3px), turquoise calc(2em - 3px), turquoise 2em, white 2em);
  background-size: calc(100% - 2.5em) 3px, auto
}
div:after {
  height: 2em;
  width: 2em;
  top: calc(100% - 3px);
  box-shadow: inset -3px 0 turquoise;
  background: linear-gradient(45deg, transparent calc(50% - 3px), turquoise calc(50% - 3px), turquoise 50%, white 50%)
}
div>p:first-of-type {
  margin-top: -1.5em;
  position: relative;
}
body {
  background: linear-gradient(45deg, yellow, gray, purple, white, yellow, gray, purple, white, yellow, gray, purple, white);
}
<div>
  <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est.</p>
</div>
<div>
  <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est.
    Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus
    lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor,
    facilisis luctus, metus</p>
</div>
<div>
  <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est.
    Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus
    lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor,
    facilisis luctus, metus</p>
</div>
G-Cyrillus
  • 101,410
  • 14
  • 105
  • 129