Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gotcha and intent behind - hidden, visiblity-hidden, display-none #101

Open
sanjarcode opened this issue Oct 28, 2023 · 0 comments
Open
Assignees

Comments

@sanjarcode
Copy link
Member

sanjarcode commented Oct 28, 2023

  • visibility: hidden: Hides an element, but the space it occupies is preserved. (least favorable)
  • display: none: Hides an element and removes it from the layout, no space is reserved. (document.querySelector will fail)
  • hidden attribute: Similar to display: none, hides an element without space reservation, mainly used in HTML5 for toggling visibility. (complete removal from rendered UI, but not from DOM)

Gotcha about hidden. Need to add [hidden] { display: none; } in CSS for "toggle" code to work

@sanjarcode sanjarcode self-assigned this Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant