css - Triangle shape with background image -


i working on project calls 2 triangles hold background images, , links.

here mock how 2 triangles.

triangles background images

currently, have 2 divs span 900x600 each triangle background image. issue having can't hover on transparent part of cinema div reach photo div.

can accomplish design css3 triangles , set background images? thought custom shape made border, border-color.

is possible css3 triangles, , if so, can me code?

here have.

.pageoption {    position: relative;    width: 900px;    height: 600px;  }  .pageoption .photo {    position: absolute;    top: 0px;    left: 0px;    width: 900px;    height: 600px;    background: url('../images/menuphoto.png') no-repeat 0 0;  }  .pageoption .cinema {    position: absolute;    bottom: 0px;    right: 0px;    width: 900px;    height: 600px;    background: url('../images/menucinema.png') no-repeat 0 0;  }
<div class="pageoption">    <a href="#" class="option photo" id="weddingphoto"></a>    <a href="#" class="option cinema" id="weddingcinema"></a>  </div>

it's easy if use child images links instead of background images. need skew 2 .option elements different transform origins, unskew child images , set overflow: hidden on both .pageoption , .option elements. support good, should work except ie8/7 , opera mini.

demo

result:

triangle images

html:

<div class='pageoption'>   <a href='#' class='option' data-inf='photo'>     <img src='../images/menuphoto.png'>   </a>   <a href='#' class='option' data-inf='cinema'>     <img src='../images/menucinema.png'>   </a> </div> 

relevant css:

.pageoption {   overflow: hidden;   position: relative;   width: 40em; height: 27em; } .option, .option img { width: 100%; height: 100%; } .option {   overflow: hidden;   position: absolute;     /* arctan(27 / 40) = 34.01935deg     * need skew 90deg - 34.01935deg = 55.98065deg   */   transform: skewx(-55.98deg); } .option:first-child {   left: -.25em;   transform-origin: 100% 0; } .option:last-child {   right: -.25em;   transform-origin: 0 100%; } .option img {   transform: skewx(55.98deg);   transform-origin: inherit; } 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -