Niclas
Niclas

Reputation: 61

Paragraph in a div should be hidden

I am having a dynamic widget on my website that displays the following structure when the website is loaded:

<div id="testdiv">
  <h2>a Headline</h2>
  <p>This paragraph should be hidden.</p>
</div>

How can i hide the paragraph? I have no idea because the generated paragraph has no class or id to hide with css (i tried <sytle>#testdiv.p{visibility:hidden !important}</style> without success.

Upvotes: 1

Views: 42

Answers (1)

dfsq
dfsq

Reputation: 193261

.p means class p. #testdiv.p means element with id "testdiv" and class name "p". p means tag, space after #testdiv means child element. So it should be:

#testdiv p {
  display: none;
}

You also probably better off with display: none. Use visibility if you want p invisible but still taking up space.

Upvotes: 4

Related Questions