Tuesday 16 July 2013

Scrollable Table with Fixed Header Using CSS




Description:-

in this example we explain that how to create a scrollbar in Table or Div or any Content so content is Display in proper way.



Css Overflow Property



Property Values

Value
Description
visible
The overflow is not clipped. It renders outside the element's box. This is default(ignore hight and width)
hidden
The overflow is clipped, and the rest of the content will be invisible
scroll
The overflow is clipped, but a scroll-bar is added to see the rest of the content
auto
If overflow is clipped, a scroll-bar should be added to see the rest of the content
 
The main Advantages of the Scrollbar is that when the size of data is Large and you can Display in Table Format.
For Example:-
          Suppose you have a 10000 Record that you have to Display in a table Format at that time it may require much more Spaces and our webpage can not contain other control so at that time you can use this Example and Display in very short size with scrollbar.

Example:-


<table style="width: 300px" cellpadding="0" cellspacing="0">
<tr>
  <td>Column 1</td>
  <td>Column 2</td>
</tr>
</table>

<div style="overflow: auto;height: 100px; width: 320px;">
  <table style="width: 300px;" cellpadding="0" cellspacing="0">
  <tr>
    <td>Value 1</td>
    <td>Value 2</td>
  </tr>
  <tr>
    <td>Value 1</td>
    <td>Value 2</td>
  </tr>
  <tr>
    <td>Value 1</td>
    <td>Value 2</td>
  </tr>
  <tr>
    <td>Value 1</td>
    <td>Value 2</td>
  </tr>
  <tr>
    <td>Value 1</td>
    <td>Value 2</td>
  </tr>
  <tr>
    <td>Value 1</td>
    <td>Value 2</td>
  </tr>
  </table>
</div>
This entry was posted in :

0 comments:

Post a Comment