By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,304 Members | 3,201 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,304 IT Pros & Developers. It's quick & easy.

"position:relative"

P: 2
I have a table with html code
<style>
div.scroll
{
height:150px;
overflow:auto;
}
table.scrollable th
{
position:relative;
}
</style>
<div class="scroll">
<table class="scrollable">
<thead><tr><td>heading1</td><td>heading2</td><td>heading3</td></tr></thead>
<tbody>
<tr><td>value1</td><td>value2</td><td>value3</td></tr>
//repeated 100 times
</tbody>
</table>
</div>
this gives me a nice scrollable table with a fixed header. This is a stand alone.
When I include the same code in my jsp file, I get a scroll bar, but my header is not fixed. My jsp respects the "overflow:auto" attribute, but does not respect the "position:relative" attribute.
I did not add the standard <!doctype....> here, but its there in my code.
any help?
Dec 26 '06 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 1,892
Post a link to your page I'm not quite clear what your asking. In this part (" //repeated 100 times") are you repeating that code 100 times? If so you should do that with javascript.
Dec 26 '06 #2

P: 2
Post a link to your page I'm not quite clear what your asking. In this part (" //repeated 100 times") are you repeating that code 100 times? If so you should do that with javascript.
here u go
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

<html><head>
</head>
<style>
div.scrollWrapper{
float:left;
overflow:visible !important;
overflow:none;
overflow-y:scroll;
height:150px;
}

table.scrollable{
margin-right:0 !important;
margin-right:16px;
border-collapse:separate;
}

table.scrollable th{
background:#f7f7f7;
position:relative;
}

table.scrollable tbody{
height:150px;
overflow:auto;
}

table.scrollable tr{
height:0px;
}

table.scrollable td{
border-left:1px solid #999999;
border-bottom:1px solid #999999;
text-align:center;
}
</style>
<body>
<div class="scrollWrapper">
<table class="scrollable">
<thead>
<tr>
<th>Numbers</th>
<th>Letters</th>
<th>Symbols</th>
</tr>
</thead>
<tbody>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
<tr><td>111</td><td>aaa</td><td>@@@</td></tr>
</tbody>
</table>
</div>
</body></html>
The above code...so when u have the above code as a 'scroll.html' it works fine..But when u have it in a jsp file...the fixed header doesnt work.

Thanks,
Raghav
Dec 27 '06 #3

Expert 100+
P: 1,892
So this isn't a HTML question more of a java question?
Dec 27 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.