HTML element Display and hide

Source: Internet
Author: User

In the Web development, the foreground HTML often need to control the hidden and display of elements, we most commonly is the level two navigation bar (through the movement of the mouse to trigger the Onmouseover,onmouseout event to achieve level two menu display and hide) level two menu display and hide.

However, there are two ways to influence and display the control element:

1. Display: Set how and whether an element is displayed

2. Visibility: Set element is visible or invisible



Example:

Result:
Summary:

Display and visibility can also be used to hide and display elements, except that the visibility property does not hide HTML elements, but whose elements (even hidden states) are in the same place, while the display property operations HTML elements do not want to , the Display property operates on the type of the element Inline,block,none these attributes are directly related to the size and existence of the element.



Used about display and visibility have encountered:

Write the level two navigation bar menu, when using display to achieve the two level of menu and hide, the results found that the first access or refresh after the first visit, the mouse moved to a level menu two sub-menu feel like to refresh the same, with visibility implementation will not appear like this problem.


HTML element Display and hide

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.