• 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

Problem with Div tag

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Can we change the height of the Div depending on the HTML content within it .
For e.g.
I have a Table which is enclosed in a Div Tag . In one page that Table occupies the whole page , while in another page it only occupies a certain small area . How can I adjust the Div height accordingly.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are going to probably have trouble figureing out what hieght the information is inside of the div, but you can adjust the height with the following code
document.getElementById("TheDivID").style.height="123px";
Eric
 
Puneet Agarwal
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following piece of code appearing one after the other
<FORM A...>
<DIV ...>
<Table ..>
contents of the table
</TABLE>
</DIV>
</FORM>
<FORM B>
<TABLE>
contents of this table
</TABLE>
</FORM>
What happens here is that the two FORM contents overlap with each other . I want them to appear one after the other .
AM I missing something...
This
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is the div positioned in anyway?
 
Puneet Agarwal
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I could get past the problem by removing the position:absolute style from the <DIV> .
My trouble right now is the height attribute . My <DIV> section is scrollable with overflow:auto and I do not want to hardcode the height . Instead the <DIV> should expand depending on contents . If I do not specify the height , then the <DIV> content is not scrollable . Any idea why . I only want the <DIV> content of my page to be scrollable .
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want the div to fit the contents, then why are you using a scrollbar that is what is making me confused at what youa re trying to accomplish.
 
Puneet Agarwal
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
May be I did not phrase correctly , I will try again
I only want a certain portion of my page to be scrollable and the rest to be fixed . Now that scrollable portion is placed inside a <DIV> tag . The problem is that if I do not specify the height attribute for the <DIV> tag , then the whole page becomes scrollable , which I do not desire . If I hardcode the height , say 75% , then only the <DIV> contents are scrollable , which is the desired behaviour . I do not want to hardcode the height attribute though .
Can you explain why is this happening.
 
reply
    Bookmark Topic Watch Topic
  • New Topic