- 1
How to make CSS component invisible?[SOLVED]
I have a side bar that contain a form. I want to make this sidebar invisible when pressing a button. When I do so the form inside the sidebar is still visible. How can I make the sidebar and all of the data inside it invisible at the same time? All help will be greatly appreciated. Thank you in advance.
13 odpowiedzi
+ 11
there are many ways
No 1:
display:none;
No 2:
visibility:hidden;
No 3:
opacity:0;
PS: if you use No 1 way, the element will not take any space but with other ways, the space taken by the element will be remain same
+ 4
Without your code nobody could give you accurate answer, because there isn't a single way to do: it depends on how you did implement your side bar with your form ^^ (there's even some cases hardest to handle, and probably at least minimal changes to do to your actual structure and/or css ti be able achieve your goal ;P)
+ 3
Use display:block; instead
+ 3
If the question is solved you should add [SOLVED] to the question title ;)
If not, we needs the complete code, not a description of how you managed it ^^
+ 1
if i understand yuor problem. the solution is to add this to your side bar:
overflow: hidden;
maybe this will help too:
https://www.w3schools.com/howto/howto_js_collapse_sidebar.asp
+ 1
MikeS can we see your code as we may be not totally grasping what you are asking. I believe yochanan sheinberger is actually giving you the correct answer.
0
Maybe visibility:hidden?
0
Farhan🇮🇳☪️ that's exactly what I am after however, how would I re-display it. Display:all; doesn't seem to work
0
I managed to fix it by doing display: none and then display:inline to re-show it when wanted
0
Yup we want code otherwise I really wrote how to use display:none and display:block but looks it's more complicated than what I think
0
Display :none;
0
Javascript:
var f = document.getElementById("myForm");
f.addEventListener("onsubmit", function() {
f.style.display = "none";
});