html - Cascading divs with triangle bottom borders -


this follow-up question: center triangle @ bottom of div full width responsively

again i'm stuck css project involving divs triangle borders @ bottom:

i want row of cascading divs (lower tringle colored red demonstration purposes):

enter image description here

my code looks this:

html, body {      padding: 0; margin: 0;      color: white;  }  .top {      background-color: #282c34;      height: 500px;      width: 100%;      position: relative;  }  .bottom {      background-color: #3b3e48;      height: 500px;      width: 100%;  }  .triangle {      border-left: 50vw solid transparent;      border-right: 50vw solid transparent;      width: 0;      height: 0;      bottom: -40px;      content: "";      display: block;      position: absolute;      overflow: hidden;      left:0;right:0;      margin:auto;  }  .uppertriangle {      border-top: 40px solid #282c34;  }  .lowertriangle {      border-top: 40px solid red;  }
<div class="top">      <div class="triangle uppertriangle"></div>  </div>  <div class="bottom">      <div class="triangle lowertriangle"></div>  </div>  <div class="top">      <div class="triangle"></div>  </div>

code on jsfiddle: http://jsfiddle.net/rndwz681/

my problems:

  • i can't figure out how align triangles correctly on z axis.
  • i can't figure out how align triangles correctly divs apart first one.

thanks lot in advance help.

by adding position:relative; .bottom class , adding z-index:100; .triangle class able triangles appear way want them to.

see fiddle: http://jsfiddle.net/rndwz681/1/

z-index sets "layer" object appears on (higher number = closer user). can applied 'positioned' elements, absolute-positioned triangles qualify.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -