Reputation: 41
Hello I'm trying to make an input field visible which is inside <div style="display:none">
like this.
<div style="display:none">
<input type="text" value="xyz" [add some attribute to force this input field to be visible or something]>
</div>
Upvotes: 0
Views: 870
Reputation: 121
It is not possible but you can hide all other elements besides the input with this CSS make sure parent is not hide.
.input-contain-div *:not(.not-hide) {display:none;}
<div class="input-contain-div">
<input class="not-hide" value="xyz" />
<span>I am hidden</span>
</div>
.input-contain-div *:not(:input.not-hide) {display:none;}
Upvotes: 0
Reputation: 13
Currently, it is not possible with CSS to make child elements visible if a parent element has display: none
. If the :has()
selector, which behaves as a parent selector, is supported by browsers you'll have that ability.
Today the only way I can think to do what you are asking would require JavaScript.
Upvotes: 1