Animation How to - Create 3D animation with border








Question

We would like to know how to create 3D animation with border.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.box {<!--from  w ww.  j  a  v a2  s. c o m-->
    position: absolute;
    top: 10px;
    left: 10px;
    width: 200px;
    height: 200px;
    background: red;
    border-top: solid #7ccbea 7px;
    border-left: solid #7ccbea 7px;
    -webkit-transition: all ease 0.5s;
}
.box:before {
  content: 'java2s.com';
  position: absolute;
  left: -150px;
  bottom: -150px;
  border: solid transparent 150px;
  border-left-color: #fff;
}
.box:after {
  content: '';
  position: absolute;
  top: -300px;
  right: 0;
  border: solid transparent 150px;
  border-right-color: #fff;
}
.box:hover {
  border-width: 100px;
}
  </style>
</head>
<body>
    <div class="box"></div>
</body>
</html>

The code above is rendered as follows: