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.
精彩评论