# NO BUG: Display: none - does not hide element wrapper and causes spacing issues

**URL:** <https://forum.bricksbuilder.io/t/no-bug-display-none-does-not-hide-element-wrapper-and-causes-spacing-issues/29341>\
**Category:** Bugs\
**Tags:** v1-11-1-1\
**Created:** [January 13, 2025, 7:07am UTC](https://forum.bricksbuilder.io/t/no-bug-display-none-does-not-hide-element-wrapper-and-causes-spacing-issues/29341 "2025-01-13T07:07:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Milan](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/m/c77e96/32.png) [@Milan](https://forum.bricksbuilder.io/u/Milan)\
**Post date:** [January 13, 2025, 7:07am UTC](https://forum.bricksbuilder.io/t/no-bug-display-none-does-not-hide-element-wrapper-and-causes-spacing-issues/29341/1 "2025-01-13T07:07:29Z")

</div>

Hi,  
I have been working on a website and have been running into an issue I hope someone might have an easy answer to.  
I have a logo, nav menu, 2 buttons, and a couple of icons, all of which take turns being hidden or not. However, although I can hide the element (display: none;) the wrapper remains present which is resulting in space being inserted although technically there is nothing there to be displayed (in this instance it is a link wrapper that is still present although I have hidden the icon with the link). Is there any way that this can be resolved? ie when you hide the element you don’t then have to try and figure out how to get rid of spacing for the hidden element?  
Thank you in advance for your help

 ![Screenshot 2025-01-13 at 11.15.09 am](https://forum.bricksbuilder.io/uploads/default/original/3X/6/5/6537ded2ff222d2be14d363d3665da5868b3fa54.png)  
(in the image I have hidden the icon with the link but spacing is still present as it is detecting the link wrapper)

---

<div class="post-metadata">

**Author:** ![timmse](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/timmse/32/1192_2.png) [@timmse](https://forum.bricksbuilder.io/u/timmse)\
**Post date:** [January 13, 2025, 9:23am UTC](https://forum.bricksbuilder.io/t/no-bug-display-none-does-not-hide-element-wrapper-and-causes-spacing-issues/29341/2 "2025-01-13T09:23:01Z")

</div>

Hi Milan,  
Welcome to the forum, and thanks so much for your report!

I moved your thread from the “Developer” category to “Bugs”, since it’s more of a bug report/how-to question 🙂

Would you be so kind as to provide a live link and a screencast using [https://jam.dev](https://jam.dev) showing and explaining what’s happening? Otherwise, it’s pretty hard to follow. Thanks!

Best regards,  
timmse

---

<div class="post-metadata">

**Author:** ![Milan](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/m/c77e96/32.png) [@Milan](https://forum.bricksbuilder.io/u/Milan)\
**Post date:** [January 13, 2025, 10:50pm UTC](https://forum.bricksbuilder.io/t/no-bug-display-none-does-not-hide-element-wrapper-and-causes-spacing-issues/29341/3 "2025-01-13T22:50:37Z")

</div>

Sorry timmse but I have already shuffled everything around in the header to fix it as I had to complete the work. I have attached an image from a screen shot before altering it. Essentially the icon element is hidden but due to the wrapper still being present the browser is inserting spacing for the element (the icon and 2 button are all in the one block together too if that helps). Hope this helps.

---

<div class="post-metadata">

**Author:** ![timmse](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/timmse/32/1192_2.png) [@timmse](https://forum.bricksbuilder.io/u/timmse)\
**Post date:** [January 14, 2025, 7:52am UTC](https://forum.bricksbuilder.io/t/no-bug-display-none-does-not-hide-element-wrapper-and-causes-spacing-issues/29341/4 "2025-01-14T07:52:39Z")

</div>

I’m glad you’ve already been able to solve your problem 💪

---

<div class="post-metadata">

**Author:** ![Milan](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/m/c77e96/32.png) [@Milan](https://forum.bricksbuilder.io/u/Milan)\
**Post date:** [January 14, 2025, 10:50pm UTC](https://forum.bricksbuilder.io/t/no-bug-display-none-does-not-hide-element-wrapper-and-causes-spacing-issues/29341/5 "2025-01-14T22:50:20Z")

</div>

Hi Timmse,

I have not actually solved the issue. More like a painful work around. I am currently recreating the header to see if I can get the issue to occur again so that I can record it with Jam. If possible, I would like this still looked into and as I said I will try to replicate the problem to send it through.

Cheers

---

<div class="post-metadata">

**Author:** ![Milan](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/m/c77e96/32.png) [@Milan](https://forum.bricksbuilder.io/u/Milan)\
**Post date:** [January 14, 2025, 11:31pm UTC](https://forum.bricksbuilder.io/t/no-bug-display-none-does-not-hide-element-wrapper-and-causes-spacing-issues/29341/6 "2025-01-14T23:31:03Z")

</div>

OK Timmse here is a link to the Jam video showing the issue that I was explaining. I hope this gives you everything you need and if not please let me know.

[https://jam.dev/c/b22eee97-f2af-4c3d-8f4b-311304d272da](https://jam.dev/c/b22eee97-f2af-4c3d-8f4b-311304d272da)

Cheers

---

<div class="post-metadata">

**Author:** ![timmse](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/timmse/32/1192_2.png) [@timmse](https://forum.bricksbuilder.io/u/timmse)\
**Post date:** [January 15, 2025, 9:16am UTC](https://forum.bricksbuilder.io/t/no-bug-display-none-does-not-hide-element-wrapper-and-causes-spacing-issues/29341/7 "2025-01-15T09:16:28Z")

</div>

Hi Milan,  
Thanks for the video and especially the link to the website!

Briefly summarized:

You insert an icon, set a link on the icon, and then set the display property to none. The result is that the icon is hidden, not the a-tag (the link) around it. Accordingly, the gap is still present, as the styles are still applied to the icon itself and not to the link, as in 99.9% of cases, you want to style the icon and not the link around it.

However, there is a straightforward and painless solution for this.

1. remove the link from the icon.
2. instead, wrap the icon with a div.
3. change the HTML tag of the div to a[link] and set your link
4. set the display property of the div/link to none

Result: no gap, because you apply the display:none value directly to the wrapper instead of the icon 🙂

---

<div class="post-metadata">

**Author:** ![Milan](https://forum.bricksbuilder.io/letter_avatar_proxy/v4/letter/m/c77e96/32.png) [@Milan](https://forum.bricksbuilder.io/u/Milan)\
**Post date:** [February 10, 2025, 5:07am UTC](https://forum.bricksbuilder.io/t/no-bug-display-none-does-not-hide-element-wrapper-and-causes-spacing-issues/29341/8 "2025-02-10T05:07:02Z")

</div>

Sorry mate just realised that I did not respond… Thank you for your help! Great solution
