473,725 Members | 2,007 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

collapsing space between hidden divs


I have 5 divs, and initially the lower 4 are hidden. I would like
everything beneath the 5th div to appear flush against the first
visible div. But right now, there is a gap of white space between the
first visible div, and everything beneath the 5th. Here is this code:

<form name="f">
<div id="Item0">Ite m 1:<input type="text" size="32" maxlength="32"
name="Name0" id="Name0"></div>
<div style="visibili ty:hidden" id="Item1">Item : 2<input
type="text" size="32" maxlength="32" name="Name1" id="Name1"></div>
<div style="visibili ty:hidden" id="Item2">Item : 3<input
type="text" size="32" maxlength="32" name="Name2" id="Name2"></div>
<div style="visibili ty:hidden" id="Item3">Item : 4<input
type="text" size="32" maxlength="32" name="Name3" id="Name3"></div>
<div style="visibili ty:hidden" id="Item4">Item : 5<input
type="text" size="32" maxlength="32" name="Name4" id="Name4"></div>
<input type="button" value="Add Another" onClick="add(); "
name="AddAnothe r">

How can I make the "Add Another" button flush against the first
visible div (i.e. eliminate all the white space between the first div
and the button), and then write a function "add" that sequentially
unhides each of the other divs, moving the "Add Another" button down
as well?

Thanks for all your help, - Dave
Jul 23 '05 #1
2 2636
Using visibility:hidd en will allow a hidden div 'box' to occupy white space in
the html document; whereas, using display:none will render the box not visible
AND not occupy white space. Unless there's some special reason for it, I'd
recommend using display:block (to view) or display:none (to render invisible).
There's also display:inline which will allow visibility. As the attribute
values 'block' and 'inline' imply, they allow the element to exist on it's own
line (block) or on the same line as its preceding elements (inline).

Hope this helps,

Jul 23 '05 #2
Thanks! Go Sharks! -

sa***********@a ol.com.nospam (SanJoseWebGuy) wrote in message news:<20******* *************** *****@mb-m20.aol.com>...
Using visibility:hidd en will allow a hidden div 'box' to occupy white space in
the html document; whereas, using display:none will render the box not visible
AND not occupy white space. Unless there's some special reason for it, I'd
recommend using display:block (to view) or display:none (to render invisible).
There's also display:inline which will allow visibility. As the attribute
values 'block' and 'inline' imply, they allow the element to exist on it's own
line (block) or on the same line as its preceding elements (inline).

Hope this helps,


Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div style="display:none"> can be displayed by setting the style attribute to "display:", or hidden with "display:none". This gives the illusion that the person filling out the form is switching from page to page...without the overhead of extra hits on the server,...
by: Aaron | last post by:
Hi, In the following code, everything looks fine on Explorer, but on Netscape there is a large white gap between the 'top' section and the 'bottom menu' section. I've set the style 'div img {display:block}' already to get rid on Netscape's problem with putting space around images, but it does nothing for this. Setting margins and padding to zero do nothing also. Here's the code:
by: Jeremy Epstein | last post by:
Hi guys, I've got a page that shows a number of packages available for sale. Each package has a little description, and then a (sometimes long) list of features for each package. I thought it would be a good idea to let visitors hide the details for each package, so that they can see just the summaries together. So I borrowed some code (can't remember from where), which was designed for expandable/collapsible menu trees, and used it to...
by: tabert | last post by:
I want to use JavaScript when a button is clicked to show and hide a SPAN or DIV. This works in both IE and Netscape, but what I'd like to happen is for there to be no white space where the hidden div is. I start with two visible divs and in between them are two more hidden ones...in Firefox this works fine--the two visible ones are right next to each other, the button fires the script and the other div shows up in the middle. Another...
by: Nigel Molesworth | last post by:
I've Googled, but can't find what I need, perhaps I asking the wrong question! I want a "FAQ" page on a web site, I hate those pages that scroll you to the answer so and I figured that a good way to do it would be to have hidden content under each question, something like this : What is the first letter of the alphabet?
by: Odo | last post by:
Hi, my Problem is that I want to use an empty div with 20pix height as a seperator. With Firefox and Safari everything is fine. But IE/Mac do not display the height, instead there is only a thin line. The Code is realy simple at the moment just 2 divs. One is my header, the other is my
by: web_design | last post by:
I'm making a form that is hidden until someone clicks on a link to open it. I can hide the form, but there is just a large white space on the screen where the form is hiding. Is there any way to close the white space when the form is not showing? At the moment I'm using a <div> and hiding the visibility, and then making it visible when the link is clicked: <div id="form" style="visibility: hidden; etc...
by: Andreas Prilop | last post by:
How many spaces should be displayed in A <span style="display:none">x</span> B between "A" and "B"? I notice that Mozilla displays one space and Internet Explorer (5 & 6) displays two spaces. See http://www.unics.uni-hannover.de/nhtcapri/temp/white-space.html for a cumulative effect. Why is this important? Instead of "span", think of the "rp" element
by: esteuart | last post by:
I need to get the right combination for a div to clip any text inside and allow vertical alignment. I only have this problem in FireFox. I have 3 divs nested within each other. The outer div has display of table, the first inner div has display of table-cell and the inner-most div has the text. The outer div has a set width and height. So here's the problem: Without the inner divs having a width and height set, the overflow:hidden doesn't...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.