开发者

applying css to everything inside element

开发者 https://www.devze.com 2023-03-20 15:51 出处:网络
How do I apply a cs开发者_高级运维s property to everything inside an element. Like if I have: p

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

精彩评论

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