SIDEBAR
»
S
I
D
E
B
A
R
«
Printing Table Header & Footer on every page with CSS
Oct 15th, 2009 by batt

พอดีว่ามันต้องทำรายงานแบบ html ที่เป็นตารางมีข้อมูลเยอะๆ อยากให้เวลาสั่งพิมพ์หรือปริ๊นท์(print) ข้อมูลมันเกินหน้ากระดาษ header กับ footer ของตารางต้องแสดงด้วยทุกหน้า

(แอบบ่น เขาบอกว่ามีตัวอย่างอยู่แล้ว ไปดูกะจะลอก แต่ใช้ไม่เห็นได้สงสัยจะเขียนไม่ครบ ไม่ง้อหรอก)

in .css

*** ถ้าจะให้มันแสดงเมื่อ print ด้วย อย่าลืม media=”print” นะจ๊
<style type="text/css" media="print,screen" >
th {
  font-family:Tahoma;
  color:black;
  background-color:#DDDDDD;
}
thead {display:table-header-group;}
tbody {display:table-row-group;}
tfoot {display: table-footer-group;}
</style>

in .html

<table border="1" cellpadding="2" cellspacing="0">
  <thead>
    <tr>
      <th>ID</th>
      <th>First Name</th>
      <th>Last Name</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>1</td>
      <td>xxxxx</td>
      <td>yyyyy</td>
    </tr>
  </tbody>
</table>
SIDEBAR
»
S
I
D
E
B
A
R
«
»  Substance:WordPress   »  Style:Ahren Ahimsa