css style iframe content

This is a discussion on "css style iframe content" within the Web Page Design section. This forum, and the thread "css style iframe content are both part of the Design Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Apr 20th, 2007, 13:53
New Member
Join Date: Apr 2007
Location: Australia
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
css style iframe content

I have xthml page with an iframe that has src="dynamic-source" for a wysiwyg editor, I'm trying to style the content inside the iframe from the page that contains the iframe. The browser sees the iframe as a separate frame therefore a separate page. As the iframe content is dynamic, I cannot include the css on the iframe's src (content page of iframe)... There must be a way to apply css style to the iframe content from the page that contains the iframe... ANY hits would be awesome!! thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Apr 20th, 2007, 14:19
Elite Veteran
Join Date: Aug 2005
Location: That Place
Posts: 2,044
Blog Entries: 1
Thanks: 0
Thanked 37 Times in 37 Posts
Re: css style iframe content

Why not have the css include dynamically as well? Pretty simple with PHP/MySQL
__________________

Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Apr 20th, 2007, 15:10
Junior Member
Join Date: Feb 2006
Location: Florence - Italy
Age: 23
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Re: css style iframe content

Wait, maybe i havent understood, you have:
Code: Select all
<body id="tmpl1">
    <iframe id="editor"> 
        <span>Title</span> 
        <div id="box"><?php editor(); ?></div>
    </iframe>
</body>
Right?
If so, you just have to reference to the content of the iframe in the css, for example:

Code: Select all
body#tmpl1 iframe#editor{background: #FFF;}
body#tmpl1 iframe#editor span {color: #00F; display:block; margin-bottom: 5px;}
And so on...



Quote:
Originally Posted by moojoo View Post
Why not have the css include dynamically as well? Pretty simple with PHP/MySQL
I dont think it's a good idea to dinamically include the css inside the page.
Keep in mind that the content of a page has to be handled by the CMS, not the structure. And i think that everything goes into <head> tag is part of the html structure.
Anyway there are pretty much easier ways to achieve the result he wants without a dinamically included css.

Last edited by Gwayn; Apr 20th, 2007 at 15:20.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Apr 21st, 2007, 00:54
New Member
Join Date: Apr 2007
Location: Australia
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: css style iframe content

Quote:
Originally Posted by Gwayn View Post

Code: Select all
body#tmpl1 iframe#editor{background: #FFF;}
body#tmpl1 iframe#editor span {color: #00F; display:block; margin-bottom: 5px;}
Unfortunately I'm having trouble being that specific from the body down to the iframe as some of the div and even table id's are also dynamic!

Here is the dom tree down to the iframe:
Code: Select all
<html>
<body>
<form id="main_form">
<table id="backend_section_4">
<tr>
<td>
<table class="sq-backend-section-table-inner">
<tbody>
<tr>
<td class="sq-backend-data">
<table class="bodytext">
<tbody>
<tr>
<td>
<table>
<tbody>
<tr>
<td id="dynamic creaded id">
<div ="dynamic creaded id">
<div id="htmlarea">
<iframe id="iframe-div">
<html>
<body>
<p>dynamic content here!!!</p>
So I have attempted to be ultra specific (I'm not predominantly a css programmer)
Code: Select all
html body form#main_form table#backend_section_4 tr td table.sq-backend-section-table-inner tbody tr td.sq-backend-data table.bodytext tbody tr td table tbody tr td div div.htmlarea iframe#iframe-div {
    color: #f30; }
With little success

Last edited by hiropowers; Apr 21st, 2007 at 00:58. Reason: update css
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Apr 21st, 2007, 01:06
New Member
Join Date: Apr 2007
Location: Australia
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: css style iframe content

Quote:
Originally Posted by moojoo View Post
Why not have the css include dynamically as well? Pretty simple with PHP/MySQL
Happy to try it... I can only reference the fileserver (not db) ... could I use include pulling in css file on fileserver? Have example?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Apr 21st, 2007, 01:18
New Member
Join Date: Apr 2007
Location: Australia
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: css style iframe content

Another thought:
Could I apply a style reference in the backend (this is open source CMS) in dom where the iframe dom is created? it was there that I was able to create an id for the iframe with
Code: Select all
iframeobj.id = "iframe-div";
So is there a dom assignment for style? such as
Code: Select all
iframeobj.style = "somehow import style from fileserver";
Really clutching at straws now

Last edited by hiropowers; Apr 21st, 2007 at 01:21. Reason: put code into [code]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Apr 21st, 2007, 14:14
Elite Veteran
Join Date: Aug 2005
Location: That Place
Posts: 2,044
Blog Entries: 1
Thanks: 0
Thanked 37 Times in 37 Posts
Re: css style iframe content

Not quite sure what the problem is, an iFrame just imports another file so why not have the css linked in the head of the other file? Even if it is dynamic you can still have a predefined structure. Oh well. Guess I misunderstood the question.
__________________

Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Apr 22nd, 2007, 01:43
New Member
Join Date: Apr 2007
Location: Australia
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: css style iframe content

Hay, no you got it - quite spot on really, if I had set this up I would do just that, find the imported file's template and add the css at the top.... however... and this is a big however ...

...the backend of this cms brings in the content of the iframe by an sql query to oracle db to bring in the content div that makes up the content of the page the user wishes to edit. At the point the backend defines what is going to be edited it is purely a php/sql query to oracle db... the db stores divs as separate assets (the app server builds pages on the fly from designs made up of xhtml and css and the div assets stored in db for content)..

... in short I cannot apply a 'template' with xhtml or css or js in the backend to 'wrap' the content being dynamically brought into the iframe...

I was interested in the dynamic applying css with php... but as the iframe has it's own dom I'm starting to think I cannot apply css to the content of the iframe from the page that contains the iframe...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Apr 22nd, 2007, 10:52
Junior Member
Join Date: Feb 2006
Location: Florence - Italy
Age: 23
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Re: css style iframe content

Quote:
Originally Posted by hiropowers View Post
Hay, no you got it - quite spot on really, if I had set this up I would do just that, find the imported file's template and add the css at the top.... however... and this is a big however ...

...the backend of this cms brings in the content of the iframe by an sql query to oracle db to bring in the content div that makes up the content of the page the user wishes to edit. At the point the backend defines what is going to be edited it is purely a php/sql query to oracle db... the db stores divs as separate assets (the app server builds pages on the fly from designs made up of xhtml and css and the div assets stored in db for content)..

... in short I cannot apply a 'template' with xhtml or css or js in the backend to 'wrap' the content being dynamically brought into the iframe...

I was interested in the dynamic applying css with php... but as the iframe has it's own dom I'm starting to think I cannot apply css to the content of the iframe from the page that contains the iframe...
OK, if you can refer to the iframe because of it's dinamic nature you can always link the css inserting the proper html string inside the php file that prints the content of the iframe.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
css iframe

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash content resets, when style.display is used (prob in firefox, IE fine) call14 JavaScript Forum 13 Feb 28th, 2008 13:58
[SOLVED] refresh a different iframe once an iframe elsewhere has loaded cosmicbdog JavaScript Forum 1 Jan 25th, 2008 01:50
Can a jsp file in an IFrame calls a javascript function outside of the IFrame jadeite100 JavaScript Forum 0 May 31st, 2007 14:29
printing style sheets to provide A5 size printouts without making content smaller paulbarris Web Page Design 5 May 9th, 2007 19:37
Set content for IFRAME in New Window noodlegarage JavaScript Forum 0 Feb 7th, 2007 07:44


All times are GMT. The time now is 04:44.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42