Slanted border using CSS

You can use half triangle with the pseudo element.

.container {
  padding: 20px;
  background-color: #F8F8F8;
  max-width: 200px;
}
.rectangle {
  width: 200px;
  height: 100px;
  background-color: #003781;
  position: relative;
}
.rectangle:after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 25px 25px;
  border-color: transparent transparent #F8F8F8 transparent;
}
<div class="container">
  <div class="rectangle"></div>
</div>

Jsfiddle

Leave a Comment