0

When a parent element has been set to display:none;, how can we make just one of its descendants visible?

css:
div: display:none;

html:
<div>
  <p id='required'>required</p>
  <p>not required</p>
</div>

How can I make p#required alone to be visible.

Limitation - I will be using this in the stylus browser extension.

music
  • 191
  • 5

1 Answers1

1

You can do this with the visibility property but not display.

Example code below

<!DOCTYPE html>
<html>
<head>
    <title>Test</title>
    <style type="text/css">
        div {
            visibility: hidden;
        }
    </style>
</head>
<body>
    <div>
      <p id='required'>required</p>
      <p style="visibility: visible;">not required</p>
    </div>
</body>
</html>
StrayAnt
  • 369
  • 2
  • 7