Toggle div content including div brder

I am using the js toggle() function to show/hide the content. The toggle function omits the div border. Can someone help me figure out why the top and bottom border remain visible after hiding the div?

Test url

That’s because you are hiding the div that is inside the one that has the border.

div#contact-form {
     border: 2px solid #eee;


The element #contact-form has the border but you are hiding the inner element called #envelope.

Either move the border on to #envelope or instead hide #contact-form instead of #envelope.

BTW don’t keep prefixing your ids with ‘div’ as that is a waste of space and ids are unique anyway.

1 Like

You are absolutely correct. Thanks for your advice!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.