• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to adjust the size of a table according to its outer cell size?

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have used tables for the layout of my form. The table width should be 100%, means it should occupy the whole browser window. In that table, I have a row with 2 columns. Each column again has tables. First column is fixed size, so I set its width as certain pixels. Second should occupy whatever width is left, even if its 0. So, I specified its width as *. I have to create a table of data dynamically in this cell. When the table is large, its occupying the size more than the browser window, I mean its stretching the entire document. but I want that table to be fixed in its cell. How can I do this?
Thanks for your time.
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
let's say your code looks like this:
(table width=100%)
(tr)(td)
(table width=300)(tr)(td)data(/td)(/tr)(/table)
(/td)
(td)
(table width=*)(tr)(td)(img src='my.gif')(/td)(/tr)(/table)
(/td)(/tr)
(/table)
furthermore let's say you have a screen-width of 640 pixel. so the table in the second collum normally has a width of 340 pixels.
but if you insert a image with a width of 400 pixels here, there is not enough screen-width to display everything on your page without scrollbars.
for an image it's no real problem, because you can set it's width, too. but if you paste a word in there, you'll get in trouble.
 
Adithya Rayaprolu
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We got the solution for this problem. We used a function the code in which is
wid = document.body.clientWidth-400;
var ele = document.getElementById("tabeId");
ele.style.width = wid;
And calling this function in body onResize event. The 400 is fixed, we will not change it later, its the size of the other portion in the screen which is constant.
 
Talk sense to a fool and he calls you foolish. -Euripides A foolish tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic