css - Cutting a triangle out of div, BUT have it horizontally centered -
sorry if has been answered can't find anywhere!!
i need transparent triangle cut out of white div (to form down arrow), css shapes it, thing i'm stumped on how create 2 100% width white blocks on either side...
like this:

any great.
many thanks
now you've provided image, i'll change answer want.
the trick i'd use create :before , :after elements absolutely positioned, 1 left , 1 right. each 1 has borders create shapes. key box-sizing trick means borders inside width, rather added onto, allowing define 50% width :before , :after pseudo elements.
note image i'm using background in demo rectangular, doesn't have triangle in image!
hmtl
<div class="box"> i'm box. </div> css
/* apply natural box layout model elements */ *, *:before, *:after { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .box { background: transparent url('http://i.imgur.com/ipgvbz0.png') no-repeat; padding: 20px; min-height: 200px; /* show image */ margin: 10px; position: relative; } .box:before, .box:after { content: ''; display: block; position: absolute; bottom: 0; width: 50%; border-bottom: 20px solid white; } .box:before { left: 0; border-right: 20px solid transparent; } .box:after { right: 0; border-left: 20px solid transparent; }
Comments
Post a Comment