Twango Posted January 20, 2010 Share Posted January 20, 2010 How do you make content inside of a div tag not appear?i'm trying the display:none, but if i do that for the div tag it doesn't work. Link to comment Share on other sites More sharing options...
jeffman Posted January 20, 2010 Share Posted January 20, 2010 Any element can be set to display:none, and it will not appear. If it is the content of the div you want to hide, like a paragraph or an image, then give that property to the paragraph or image.If you have text in the div but not also in a paragraph or span or something, then the text can be hidden only if the div is hidden.You might be running into problems with competing definitions. Like one definition makes the display:block, and another is display:hidden. There are two answers.1. The definition closest to the element overrides any previous definitions (internal beats external, bottom of the stylesheet beats the top, inline beats stylesheet) ;2. unless the previous CSS selector is more specific. Like:#holder .wrapper inputis more specific theninput. . . so a later definition may be ignored.I usually discover and fix that problem by trial-and-error. Link to comment Share on other sites More sharing options...
Twango Posted January 20, 2010 Author Share Posted January 20, 2010 Any element can be set to display:none, and it will not appear. If it is the content of the div you want to hide, like a paragraph or an image, then give that property to the paragraph or image.If you have text in the div but not also in a paragraph or span or something, then the text can be hidden only if the div is hidden.You might be running into problems with competing definitions. Like one definition makes the display:block, and another is display:hidden. There are two answers.1. The definition closest to the element overrides any previous definitions (internal beats external, bottom of the stylesheet beats the top, inline beats stylesheet) ;2. unless the previous CSS selector is more specific. Like:#holder .wrapper inputis more specific theninput. . . so a later definition may be ignored.I usually discover and fix that problem by trial-and-error.So. there is no way to make an <input> tag inside a <div> to be hidden without making the individual elements hide/show? Link to comment Share on other sites More sharing options...
jeffman Posted January 20, 2010 Share Posted January 20, 2010 I really don't understand the question. I can't think of a reason why you cannot use the display property to hide any element. Some circumstances might require you to tweak your selector, but that's just a matter of helping CSS find the element. Hiding it is easy. display:none, just as you wrote.Now we could keep talking theoretically like this. But if you still get nowhere, post some code. Link to comment Share on other sites More sharing options...
Ingolme Posted January 20, 2010 Share Posted January 20, 2010 You can set visibility to "hidden".The <div> will still occupy the space, but be invisible. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.