使用 CSS 在 <div> 内设置 <p> 标签的样式

Styling <p> tag inside <div> by using CSS

(HtMl)

<div>
  <h2>I am another awesome h2</h2>

  <p>number one paragraph</p>

  <p>I'm the second paragraph inside this div!</p>
</div>

<p>PARAGRAPH NOT INSIDE A DIV</p>


<div>
  <h2>A less awesome h2</h2>

  <p>number one</p>

  <p>One last paragraph here!</p>
</div> 

(CSS)

我尝试使用 nth-of-type 和 nth-child 但我无法选择 SECOND DIV 中的两个 P 元素。

有人能帮忙吗?

注意:我的网页中有太多 P 标签和 DIV。我想选择那些不使用 class 或 id.

在这种情况下使用选择器非常简单,只需尝试

div:nth-of-type(2) p {...}