css控制表格屬性

首先是在html頁面里加入下面代碼:

<table class="table">
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>


<tr>
<td>Apple</td>
<td>Steven Jobs</td>
<td>USA</td>
</tr>


<tr class="alt">
<td>Baidu</td>
<td>Li YanHong</td>
<td>China</td>
</tr>


<tr>
<td>Google</td>
<td>Larry Page</td>
<td>USA</td>
</tr>


<tr class="alt">
<td>Lenovo</td>
<td>Liu Chuanzhi</td>
<td>China</td>
</tr>


<tr>
<td>Microsoft</td>
<td>Bill Gates</td>
<td>USA</td>
</tr>


<tr class="alt">
<td>Nokia</td>
<td>Stephen Elop</td>
<td>Finland</td>
</tr>
</table>

然後在新建的css中添加下面控制屬性的代碼:

.table
  {
  position:relative;
  margin:0px auto ;
  font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
  width:980px;
  HEIGHT: 400px
  }


.customers td, .customers th 
  {
  font-size:1em;
  border:1px solid #98bf21;
  padding:3px 7px 2px 7px;
  }


.customers th 
  {
  font-size:1.1em;
  text-align:left;
  padding-top:5px;
  padding-bottom:4px;
  background-color:#A7C942;
  color:#ffffff;
  }


.customers tr.alt td 
  {
  color:#000000;
  background-color:#EAF2D3;
  }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章