开发者

applying css to everything inside element

How do I apply a cs开发者_高级运维s property to everything inside an element.

Like if I have:

p
    {
         font:15px "Lucida Grande", Arial, sans-serif;
        padding-right:150px;
    }

<p>
<span>
<div>
</div>
</span>
</p>


You posted invalid HTML. Block-level elements such as <div> do not go inside of <p> tags, and especially not inside of inline elements such as a <span>.

Anyway, the CSS selector to match anything is *

p, p * {
    font: 15px 'Lucida Grande', Arial, sans-serif;
    padding-right: 150px;
}

Be careful using the * selector. It is "slow" when there are a lot of elements to match.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜