Using z-index in a table cell to write over an image - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table Cell

Description

Using z-index in a table cell to write over an image

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">
table {<!--   w w  w . j a  v a  2 s .c  o m-->
   display:inline-table;
   margin:11px;
   vertical-align:bottom;
}

table, th, tr, td {
   border:2px solid Chartreuse;
   border-collapse:separate;
}

th {
   font-weight:bold;
}

th, td {
   padding:6px;
}

table.first td {
   background:url('https://www.java2s.com/style/demo/Google-Chrome.png') no-repeat;
   width:301px;
   height:292px;
   text-align:center;
   color:yellow;
   font-weight:bold;
}

table.second {
   position:relative;
}

table.second td p {
   background:none repeat scroll 0 0 blue;
   color:pink;
   left:7%;
   padding:5px;
   position:absolute;
   top:49%;
}
</style> 
 </head> 
 <body> 
  <table class="first"> 
   <tbody> 
    <tr> 
     <td>Lorem ipsum dolor sit amet, co</td> 
    </tr> 
   </tbody> 
  </table> 
  <table class="second"> 
   <tbody> 
    <tr> 
     <td> <img src="https://www.java2s.com/style/demo/Google-Chrome.png" alt="hello" title="image with title"> <p>Lorem ipsum dolor sit amet, consectetur adipis<code>Lor</code>Lorem </p> </td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials