css3 - create an adaptive quadrilateral trapezoid in css -


is possible create image shapes in css? i've googled more i'd admit on last week without finding solution.

enter image description here

i have been able semi-replicate haven't gotten requirements worked out.

  • have border
  • be responsive
  • adapt content height (in cms don't have control on amount of text)
  • work in ie9

it needs adapt content height , responsive.

one attempt used multiple clip-paths fails in ie. jsfiddle

<div class="clip-block">   <div class="clip-wrap">     <p class="clip-css">lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>   </div> </div>  .clip-wrap {     display: inline-block;     clip-path: polygon(0 22%, 120% 0, 120% 100%, 0 78%); }  

another attempt tried using svg clip (it works in ie fails in other requirements (eg. content within shape)). another jsfiddle

<svg class="svg-defs">   <defs>     <clippath id="clipping">       <polygon points="0,50 700,0 700,300 0,250" />     </clippath>       </defs> </svg>  <div class="wrapper">  <div class="item--svg-clip-path-svg">     <div class="demo">       <svg width="1000" height="1000">         <image xlink:href="https://placeimg.com/1000/1000/animals" width="1000" height="1000" />       </svg>     </div>     </div> </div>   .item--svg-clip-path-svg image, .item--svg-clip-path-html img {     clip-path: url(#clipping);     border: 2px solid red; } .svg-defs {     position: absolute;     width: 0;     height: 0; } 

you can 3d transforms:

.container{     position: relative;     max-width: 300px; perspective: 500px; padding: 20px; } .text{     position: relative;     z-index: 2; } .cuadrilateral{     position: absolute;     z-index: 1;     top: 0;     left: 0;     right: 0;     bottom: 0;     background: #fbb;     border: 3px solid #f66;     -ms-transform: rotatey(-10deg) translatex(-5px);     transform: rotatey(-10deg) translatex(-5px); } 

and here pen you: http://codepen.io/vandervals/pen/oxxqnx


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -