Animation How to - Use CSS3:RGBA function to create transparent color








Question

We would like to know how to use CSS3:RGBA function to create transparent color.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
div#caja1{background-color: rgba(0, 255, 0,1);top:30px; left:100px; width:100px; height:100px;}
div#caja2{background-color: rgba(0, 0, 255, 0.4); top:100px; left:40px; width:100px; height:100px;}
div#caja3{background-color: rgba(255, 0, 0, 0.4);  top:10px; left:10px; width:100px; height:100px;}
div{<!--from w  ww. ja  v a  2 s . c  o  m-->
    position: absolute;
    padding: 20px;
    vertical-align: middle;
    text-align: center;
    font-size: 50px;
}
  </style>
</head>
<body>
   <div id="caja1"> 1</div>
   <div id="caja2"> 2</div>
   <div id="caja3"> 3</div>
</body>
</html>

The code above is rendered as follows: