Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个看起来像这样的页面结构:
<article><p>Title</p></article>
我想修改p只有当它在<article>. 我试过
p
<article>
article > p { font: 15px; }
和:
article p { font: 15px; }
但是它们都不起作用:(我该怎么做?
您的选择器是正确的。问题是当您使用速记font属性时,您可以指定的最小值是font-sizeand font-family:
font
font-size
font-family
article p { font: 15px Arial; }
请注意,您的第二个示例使用了子选择器,我认为 IE6 不支持它,因此我建议使用第一种格式。
这是上面的一个工作示例。