Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

applying css to everything inside element

Tags:

html

css

How do I apply a css 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>
like image 337
re1man Avatar asked Sep 19 '25 22:09

re1man


1 Answers

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.

like image 92
simshaun Avatar answered Sep 22 '25 21:09

simshaun