have 2 colors in TD background with CSS - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table Column

Description

have 2 colors in TD background with CSS

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">

.holiday, .my {<!--   ww w.  j  a  v a 2 s.c  om-->
   text-align: center;
   font-size: 11px;
   font-weight: bold;
   color: #ffffff;
   background-color: #da1030;
   border: 1px solid black;
   height:20px;
   width:20px;
   position: relative;
}
.my {
   background-color: purple;
}
.holiday.my:after {
   position: absolute;
   width: 50%;
   height: 100%;
   right: 0;
   background-color: red;
   content: "";
   top: 0;
}


      </style> 
 </head> 
 <body> 
  <table> 
   <tbody> 
    <tr> 
     <td class="holiday"></td> 
     <td class="my"></td> 
     <td class="holiday my"></td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials