Nigel Horne
Nigel Horne

Reputation: 53

CSS not honouring display initial

I can't workout how to get the second paragraph to display in this example code. I've only tried it in Firefox.

<!DOCTYPE html>
<html>
<head>
<style>
body {
    display: none;
}
.show {
    display: initial;
}
</style>
</head>
<body>

<p>para 1</p>
<div class="show">
    <p>para 2</p>
</div>
</body>
</html>

Upvotes: 0

Views: 63

Answers (2)

Nigel Horne
Nigel Horne

Reputation: 53

I'm going with this:

p {display: none} .show p {display: initial}

It's more work for me, but it does what I want. Thanks.

Upvotes: 0

GvM
GvM

Reputation: 1733

body{
  visibility:hidden}
.show {
  visibility: visible;
  }
<p>para 1</p>
<div class="show">
    <p>para 2</p>
</div>

you can try this instead

Upvotes: 1

Related Questions