Auto-resizing skewed background in CSS - HTML CSS CSS Animatable Property

HTML CSS examples for CSS Animatable Property:transform

Description

Auto-resizing skewed background in CSS

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
body {<!--from   w  w w.ja  v  a  2  s. c  om-->
   padding:11px;
   font:14px Arial;
}

.text-block {
   overflow:hidden;
   height:46px;
   display:inline-block;
   postion:relative;
}

.text:before {
   position:absolute;
   content:'';
   left:-36px;
   top:0;
   bottom:0;
   width:46px;
   height:46px;
   background:Chartreuse;
   display:block;
   -webkit-transform:rotateZ(-10deg);
}

.text:after {
   position:absolute;
   content:'';
   right:-34px;
   top:0;
   bottom:0;
   width:46px;
   height:46px;
   background:yellow;
   display:block;
   -webkit-transform:rotateZ(12deg);
}

.text {
   display:inline-block;
   height:41px;
   line-height:41px;
   background:blue;
   color:pink;
   position:relative;
   top:-6px;
   -webkit-transform:rotateZ(-4deg);
   padding:0 31px;
}
</style> 
 </head> 
 <body> 
  <span class="text-block"> <span class="text"> Skiba-de-dabba-de-dabba-do </span> </span> 
  <span class="text-block"> <span class="text"> Small </span> </span> 
  <span class="text-block"> <span class="text"> Slightly Bigger </span> </span>  
 </body>
</html>

Related Tutorials