I am trying to have a table header, in a seperate div stay in place while a div undernearth is able to scroll al arge list of records. Both divs are in a div named Layer 3. Hereis the css file I am using:
#Layer3 { position:absolute; width: 89%; height: 40%; left: 10%; top: 56%; background-color: #f1ffff; } #Layer3 h1 { font-size: medium; color: #000033; text-decoration: none; text-align: center; } .tableheader { } .tablecontent { overflow: auto; }
and part of the php code I am using to generate the html:
echo '<div id='tableheader' class='tableheader'>'; echo '<h1>{$query} Auctions</h1>' . '\n'; echo '</div>'; echo '<div id='tablecontent' class='tablecontent'>'; echo '<table border='0' width='100%'><tr>' . '\n'; echo '<td width='15%'>Seller ID</td>' . '\n'; echo '<td width='10%'>Start Date</td>' . '\n'; echo '<td width='75%'>Description</td>' . '\n'; echo '</tr>\n'; // printing table rows foreach ($rows as $row) { $pk = $row['ARTICLE_NO']; echo '<tr>' . '\n'; // table contens generated in here echo '</tr>' . '\n'; } } echo '</div>';
I am not sure what I have missed, but tableheader does not seem to be stationary, or even separate from tablecontent.
div name does not equal div id. #Layer3 is referencing an element with an id of Layer3. Only one element is allowed to have a given id; all ids must be unique.
Don’t forget to close your tags (table).
If div#Layer3 is scrolling everything inside it then it has some overflow set. Redefine it to overflow:hidden in the #Layer3 style. You may need to try playing with margins and floats to get things positioned right, but ill leave that to you.