Hiding in Practice

In the following example, this exact technique is used to create an “additional information” type box.

Used for Dropdown Menus

This same technique can be used for to create dropdown menus.

The following code is one solution to creating a horizontal menu with a dropdown. Notice in line 36, that the content is hidden. Lines 48-49, cause the menu to be displayed, and lines 53-62 are used to present and style the dropdown menu. (If you cannot see the line numbers, click the “Edit on Codepen” link in the top-right of the code window.)

Please study the following code to understand it better.