Making jagged triangle border in CSS - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Shape

Description

Making jagged triangle border 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">

.header{<!--from   w  ww .  j  a v a  2 s  .  c  o m-->
   color:white;
   background-color:#2B3A48;
   text-align:center;
}
.header:after {
   content: " ";
   display:block;
   position: relative;
   top:0px;left:0px;
   width:100%;
   height:36px;
   background: linear-gradient(#2B3A48 0%, transparent 0%), linear-gradient(135deg, #272220 33.33%, transparent 33.33%) 0 0%, #272220 linear-gradient(45deg, #272220 33.33%, #2B3A48 33.33%) 0 0%;
   background: -webkit-linear-gradient(#2B3A48 0%, transparent 0%), -webkit-linear-gradient(135deg, #272220 33.33%, transparent 33.33%) 0 0%, #272220 -webkit-linear-gradient(45deg, #272220 33.33%, #2B3A48 33.33%) 0 0%;
   background: -o-linear-gradient(#2B3A48 0%, transparent 0%), -o-linear-gradient(135deg, #272220 33.33%, transparent 33.33%) 0 0%, #272220 -o-linear-gradient(45deg, #272220 33.33%, #2B3A48 33.33%) 0 0%;
   background: -moz-linear-gradient(#2B3A48 0%, transparent 0%), -moz-linear-gradient(135deg, #272220 33.33%, transparent 33.33%) 0 0%, #272220 -moz-linear-gradient(45deg, #272220 33.33%, #2B3A48 33.33%) 0 0%;
   background-repeat: repeat-x;
   background-size: 0px 100%, 9px 27px, 9px 27px;
}


      </style> 
 </head> 
 <body> 
  <div class="header"> 
   <h1>This is a header</h1> 
  </div>  
 </body>
</html>

Related Tutorials