Sunday, August 08, 2004

Inline frames and style sheets

Using inline frames (iframe elements) to embed documents into HTML documents
Continuing my adventures with the blogroll, I got the iframe working and I got the style code working, but the style in the host document doesn't affect the content of the iframe. So, how can one apply a style across the iframe boundary?

Alas, it's not simple -- as this document makes clear:
The embedded document is displayed according to what's applicable to it, not what's applicable to the embedding document ... a style element in a document applies only to the document where it appears, not to any embedded document. .... If there are style sheet rules which should be applied both to the embedding document and to the embedded document, it is best to write them into an external style sheet and use a link element to refer to it in both documents... the dimensions of the inline frame can be affected by a style sheet for the embedding document. Similarly, the border around an inline frame is a matter of the embedding document.
Uh-Oh. I've got a bad feeling about this. I don't control the code of the blogroll, so I can't use either of these approaches!

It does look that if one uses an inline frame to hold a blogroll, one has no control over how the blogroll contents display. I think I might have do some indirection. I might try this:

1. Create a document I control that holds the blogroll and has a style sheet.
2. Include THAT document in the iFrame.

More later ...

No comments:

Post a Comment