Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

css, disable display: none;

Tags:

css

I have this situation in my code:

<!-- This is the global CSS file -->
<style type="text/css">
#show_div{
    display: none;
}
</style>
<!-- This is the local CSS file (only in this page)-->
<style type="text/css">
#show_div{
    /* However to disable display: none;*/  
}
</style>
<body>
<div id = "show_div">
    Text text
</div>

I usually need to hide this element, but on one page, I need to show it. In global css file I have:

#show_div{
    display: none;
}

How can I disable display: none;? I can not use jQuery, $('#show_div').show(); (or JavaScript).

Thanks

If you do not understand my problem, then I apologize. I can try to explain again.

like image 723
lolalola Avatar asked Oct 24 '10 19:10

lolalola


People also ask

What does CSS display none do?

display: none; is commonly used with JavaScript to hide and show elements without deleting and recreating them.

How do I remove style block display?

Answer: Use the jQuery css() Method You can use the jQuery css() method to change the CSS display property value to none or block or any other value. The css() method apply style rules directly to the elements i.e. inline.

How do I show display none in CSS?

getElementById("element"). style. display = "none"; To show an element, set the style display property to “block”.


3 Answers

Change the body class or id of the page you want it to be visible on

<style>
#show_table #show_div{
display:block!important;
}
</style>


<body id='show_table'>
<div id='show_div'>
text text 
</div>
like image 129
Jason Avatar answered Sep 23 '22 13:09

Jason


Use display: block to get the default display for a <div> element, like tis:

#show_div { display: block; }
like image 42
Nick Craver Avatar answered Sep 21 '22 13:09

Nick Craver


Set it to a different value, but it sounds like you'd be better off just including the content in the page you want it to appear in instead of putting it everywhere and hiding it.

like image 36
Quentin Avatar answered Sep 23 '22 13:09

Quentin