0

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?

5
  • @BenM Sorry, you misunderstood me. I want the entire file just to work inside #lol without changing the content of content.css Commented Nov 30, 2012 at 11:02
  • Sorry, I understand what you're asking. This can't be achieved without changing your CSS selector. You know what the 'c' stands for in 'CSS', I assume... ;-) Commented Nov 30, 2012 at 11:03
  • give me a moment, I'm going to explain my entire situation. Its a bit complicated =P Commented Nov 30, 2012 at 11:05
  • @BenM I changed my question. Commented Nov 30, 2012 at 11:14
  • I discussed this with my teacher. We came to the conclusion that it is not possible and we should use different stylesheets for the iframe and div#content Commented Nov 30, 2012 at 12:11

1 Answer 1

6

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;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.