CSS for hiding a HTML element, keeping its width and height?

前端 未结 2 1490
醉梦人生
醉梦人生 2021-01-17 09:24

I need a CSS snippet for hiding a HTML

(with quite a lot of contents, including text and other divs), but still reserving space for it.
相关标签:
2条回答
  • 2021-01-17 09:58

    use document.getElementById("my").style.display = "none"; do not user visibility it only hide element but in display it remove the space acquired by element.

    0 讨论(0)
  • 2021-01-17 10:05
    visibility: hidden
    

    This will hide the element from the page but retain its place in the layout.

    0 讨论(0)
提交回复
热议问题