Dynamic Styles: Hiding Elements without Reflowing

Dynamic Styles

Hiding Elements without Reflowing

While setting the display property to none removes the paragraph and reclaims the empty space, turning the visibility property on and off just makes the paragraph transparent, without reflowing the page. Here is the former example, only this time clicking the link will turn off and on the visibility of the first paragraph:

Click here to remove or bring back the first paragraph below:
Mouse over this paragraph and see how the font size changes to size 30. Mouse out and see it go down to 8. This is a good way to pack more text on a window-size page and let the user magnify the paragraph currently being read. See how the browser reflows the page as if this paragraph was originally written with the current font size.
Mouse over this paragraph and see how the font family changes to size Courier. Mouse out and see it changing to Arial. This is a good way to emphasize the paragraph currently being read. See how the browser reflows the page as if this paragraph was originally written with the current font family.

Notice how the emptied space is not reclaimed back by the browser. Comparing this page with Page 5, the only difference is the definition of the disappear() function. For visibility changes it is: