-1

I have something like this:

<div id="content" style="visibility: hidden;">
<!-- 500 lines of HTML --->
</div>

This div contain divs that are shown via Javascript. The problem is that it makes my site's height too big even if nothing is shown.

I know I could just add the divs to be generated in the Javascript file, but I wonder if there is a CSS solution, since I like to have the "skeleton" in the HTML instead of the Javascript.

prgrm
  • 3,734
  • 14
  • 40
  • 80
  • 2
    why not use `style="display: none"` - am I missing something? – StudioTime Jun 13 '17 at 12:45
  • @DarrenSweeney I didn't know that existed, I never do frontend. Sorry. – prgrm Jun 13 '17 at 12:48
  • @MihaiT "how to hide divs" gave me visibility:hidden. – prgrm Jun 13 '17 at 12:58
  • how to hide divs gives me this link https://stackoverflow.com/questions/1992114/how-do-you-create-a-hidden-div-that-doesnt-create-a-line-break-or-horizontal-sp anyway . try more than the first link google gives you :) Possible duplicate of [How do you create a hidden div that doesn't create a line break or horizontal space?](https://stackoverflow.com/questions/1992114/how-do-you-create-a-hidden-div-that-doesnt-create-a-line-break-or-horizontal-sp) – Mihai T Jun 13 '17 at 13:00

2 Answers2

1

You can use display:none; instead of visibility:hidden;.

If you want to make it visible again, simply change it to display:block;.

1

style="display: none" in the css

Ervin Cosic
  • 114
  • 1
  • 12