Search code examples
javascripthtmlstylesheet

Hidden HTML elements take space


I'd like to make some empty hidden elements (iframes would be nice, paragraphs would do) that Javascript would later fill and modify. I have not been able to figure out how to keep these elements from taking up space. I've turned off margins and padding and set height to zero but still end up with blank space.

I'd like to see an example of an hidden element that takes no space on the page. Actually, I'd like to see the HTML, CSS, and Javascript. :-).


Solution

  • If you're using visibility: hidden; you should be using display: none; instead.