Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to get rid of whitespace when showing/hiding divs 1

Status
Not open for further replies.

spastica

Programmer
Sep 27, 2002
72
GB
I have divs containg text/form elements which show and hide depending on options the user selects.

the problem is, when the divs are hidden, there is whitespace in place of wehre the divs should be, so it looks like there are huge gaps between lines on the page. is there any way to get rid of this whitespace? thanks in advance! :)
 
You are using visibility.

You want to use display.

Hides a div:

Code:
element.style.display = 'none';

Shows a div:

Code:
element.style.display = '';

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
perfect - thank you so much for all your help with these hide/show div problems i've been having - how do i vote for you as one of the most helpful tip-givers? :)
 

You just did. Thanks a lot :)

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top