HTML Colgroup


Rajeev Ranjan Tiwari


HTML 


Set the background color of the three columns with the <colgroup> and <col> 

  
<table style="width:100%">
  <tr>
    <th>ISBN</th>
    <th>Title</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>3476896</td>
    <td>My first HTML</td>
    <td style="text-align:right">$53</td>
  </tr>
  <tr>
    <td>2489604</td>
    <td>My first CSS</td>
    <td style="text-align:right">$47</td>
  </tr>
</table>

Specify width of a table column (with CSS):

<table>
  <tr>
    <th style="width:200px">Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
</table>

<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
  border: 1px solid black;
}

colgroup {
  display: table-column-group;
</style>
</head>
<body>

<p>Look how the colgroup element is displayed below:</p>

<table>
  <colgroup>
    <col span="2" style="background-color:red">
    <col style="background-color:yellow">
  </colgroup>
  <tr>
<td>January</td>
    <td>$100</td>
  </tr>
<td>3476896</td>
    <td>My first HTML</td>
    <td>$53</td>
  </tr>
  <tr>
    <td>5869207</td>
    <td>My first CSS</td>
    <td>$49</td>
  </tr>
</table>
<p>Change the default CSS settings to see the effect.</p></body>
</html>
Thanks friend

Comments

Popular posts from this blog

FBT Tax

OT Technician

URL क्या है