user1534664
user1534664

Reputation: 3418

Apply CSS to certain part of website

I'm building a WISYWIG in which I have an iframe that needs to have content.css applied to it.

content.css: (will be applied to the iframe (src: ./content/home.php))

#content h4
{
    font-size:30px;
color:brown;
text-shadow: 1px 1px #000000;
text-align:center;
}

editpage.php: // wisywig

<iframe id="content" src="./content/home.php"></iframe>

home.php contains content that needs to be shown on the homepage of my website. As you can imagine the #content in front of my h4 is used to apply this same css to a div inside my website. However, when I apply this same css to my iframe this css wont find a #content inside the iframe. Hence my previous question.

How can I apply this CSS to both a <div id="content"> and an iframe?

Upvotes: 0

Views: 136

Answers (1)

BenM
BenM

Reputation: 53198

Yes. To apply your style to everything inside #lol, just use the * selector:

#lol * {
    display:inline-block;
    color:green;
}

If you only want direct descendants of #lol:

#lol > * {
    display:inline-block;
    color:green;
}

Upvotes: 6

Related Questions