Add transparency to the background with CSS

Use the opacity property to add transparency to the background of an element. You can try to run the following code to work.


Live Demo

<!DOCTYPE html>
         div {
            background-color: #808000;
            padding: 20px;
         } {
            opacity: 0.2;
            filter: alpha(opacity=20);
         div.two {
            opacity: 0.5;
            filter: alpha(opacity=50);
      <p>Check transparency in the below section:</p>
      <div class = "one">
         <p>opacity 0.2</p>
      <div class = "two">
         <p>opacity 0.5</p>
         <p>opacity 1</p>