1 reply [Last post]
Last seen: 19 years 9 weeks ago
Joined: 2004-03-30
Posts: 5
Points: 0

Hello I have a table with two rows.
The top row should stretch horizontally all the way to the edge of the screen, no matter how wide the screen is (including a horizontal scrollbar).
For some reason, it is cut off.

here is a sample code that shows what I am talking about:

 <table border="1" cellspacing="0" cellpadding="0" width="100%">
   <td width="100%">title</td>
   <td style="position:relative;width:100%; height:100%; z-index:0;">
     <!-- here I place some div at specific screen coorinates (some of them may span to the right of the screen -->
     <div style="position:absolute; left:500px; top:40px;width:700px;height:20px"></div>

Note that I placing an obsolutely positioned div at such a coordinate and with such size, so that it forces the screen to have a horizontal scrollbar (very good). However, the top row of the table only streches until the edge of the screen, and doesn't continue all the way (if you scroll horizontally).

can anyone know how I can fix this?
I must use absolute positioning for the divs.

thanks in advance

Sydney, Australia
Last seen: 19 years 29 weeks ago
Sydney, Australia
Timezone: GMT+10
Joined: 2003-11-15
Posts: 389
Points: 0

how to cause a header to stretch horizontally?

When something is absolutely positioned it is taken out of the natural flow of the html.

The table will stretch to the width of the veiwport whatever size that is, but in essence does not see the absolute positoned div.

The browser recognises that it needs to give the viewer a horizontal scrollbar, but does not recognise it needs to stretch the table.


The only way to learn is to do it yourself