html - How I can set the background image to table cells that have a colspan? -
i use css set background cell not apply whole cell.
i trying set background image first , last <tr>
, it's showing this.
i trying apply .first
class property first , last <tr>
. should applies tr?
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <style type="text/css"> .excel{ background:url(smallimage/excel.jpg); background-size:24px 24px; background-repeat:no-repeat; position: relative; margin:3px; left: 2px; top: 1px; } td.yellostar{ background-image: url(smallimage/yellowstar.jpg); /* forward slash path */ width: 20px; /* use own image size; */ height: 20px; /* use own image size; */ background-repeat: no-repeat; background-position: center; text-align: center; vertical-align: top; } .first{ background-image:url(smallimage/trbackgr.jpg); background-repeat: repeat-x; } </style> </head> <body> <table width="95%" border="1" cellspacing="0" cellpadding="0"> <tr class="first"> <th colspan="2" class="first">chapter #|chapter name</th> <th>linkage</th> <th>project<br/>count</th> <th>task<br>count</th> <th>issues<br> open/all</th> <th>action</th> </tr> <tr > <td>05</td> <td><div class="excel" >    <u>chapter 5:data of information</div></td> <td class="yellostar" ></td> <td><p align="center">3</p></td> <td><p align="center">21</p> </td> <td> </td> <td> </td> </tr> <tr> <td>06</td> <td><div class="excel">   <u>chapter 6:data tabels , amortization tabels</div></td> <td class="yellostar"> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>07</td> <td><div class="excel" >   <u>chapter 7:data consolidation,links , formula auditing</div></td> <td class="yellostar"> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>08</td> <td><div class="excel" >   <u></td> <td class="yellostar"> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>09</td> <td><div class="excel" >   <u></div></td> <td class="yellostar"> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>10</td> <td><div class="excel" >   <u></div></td> <td class="yellostar"> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr class="first"> <td colspan="7" class="first" > </td> </tr> </table> </body> </html>
you can use pseudoclasses :first-child
, :last-child
. @ example: jsfiddle
but :last-child
not cross-browser, fixes needed ie.
and have error in specifying reference image background w3schools.
Comments
Post a Comment