Page Widget How to - Create banner cut-out








Question

We would like to know how to create banner cut-out.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
div {<!--from w ww .ja  va2s . c  o  m-->
  width: 250px;
  padding: 9px 0 9px 5%;
  color: #fff;
  background-color: #d32f36;
  clip-path: url(#mask);
  -webkit-clip-path: polygon(0 0, 100% 0, 95% 50%, 100% 100%, 0 100%, 5% 50%);
  clip-path: polygon(0 0, 100% 0, 95% 50%, 100% 100%, 0 100%, 5% 50%);
}
</style>
</head>
<body>
  <div>Banner text here</div>
  <!-- For firefox -->
  <svg class="svg-graphic" width="250" height="36" viewBox="0 0 250 36"
    xmlns="http://www.w3.org/2000/svg"
    xlink="http://www.w3.org/1999/xlink" version="1.1">
    <clipPath id="mask">
        <polygon points="0, 0, 250, 0, 235, 18, 248, 35, 1, 35, 15, 18" />
    </clipPath>
</svg>
</body>
</html>

The code above is rendered as follows: