html - Diagonal CSS3 Background Color/Images -


basically trying cut background of div off @ angle. please see image below example: notice navigation section cut off , header image below.

http://imgur.com/fst4r9t

is there way create effect using css3? have tried this:

.site-header {     background-color: #0c3063;     width: 960px;     height: 300px;     @include clearfix;     position: relative;     z-index: 1;      &:after {         content: "";         width: 100px;         position: absolute;         top: -162px;         right: -150px;         width: 300px;         height: 300px;         background-color: black;         transform: rotate(45deg);         z-index: 2;     } } 

in example above overlaps know how fix this, use before instead of after. there better way of doing this?

my example seems can not put :after content before parent solution not ideal :( ideas?

edit: https://jsfiddle.net/6x3yenge/1/

thanks

though following code not achieve want image, surely job top menu. using borders create triangles simplies things lot.

jsfiddle link: https://jsfiddle.net/qvjhptpy/

html:

<body>     <div class="menu">         <div class="main"></div>         <div class="cut"></div>     </div> </body> 

css:

body {     background: yellow; }  .menu {     background: transparent;     font-size: 0px;  /*in case gap coming between .main & .cut nested divs (due whitespace in html code)*/ }  .main {     display: inline-block;     width: 200px;     height: 100px;     background: red; }  .cut {     display: inline-block;     border: 50px solid transparent;     border-top: 50px solid red;     border-left: 50px solid red; } 

Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -