I have a page structure which looks like:

<article><p>Title</p></article>

I'd like to modify the p only when it's inside the <article>. I tried

article > p {
  font: 15px;
}

And:

article p {
  font: 15px;
}

But neither of them work :( How shall I do it?

有帮助吗?

解决方案

Your selectors are correct. The problem is that when you use the shorthand font property, the minimum you can specify is the font-size and font-family:

article p {
    font: 15px Arial;
}

Note that your second example uses the child selector, which I don't believe is supported in IE6, so I'd recommend using the first format.

Here's a working example of the above.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top