From: Andy on
Hi,

I am showing existing html documents in an iframe. These documents
are allowed to have any css for body and subelements that they wish,
as well as inline styles, so that they are in control of their own
margins.

What I would like to do is have a failsafe way to munge the document,
changing it by adding margin space on the left and right of 50px each.

My idea is that I have to parse the existing css rules for body, if
any and save them. Then I have to insert my own div tag between
<body> and </body> which takes the existing doc's body css and applies
it to my inserted div. Then I have to strip all of the body css from
the munged document, and make it have my own margins. Is this going
to work?

If so, can anyone tell me details that I've overlooked, and/or some
example css.

Andy
From: dorayme on
In article
<d706bcb1-9a7f-417f-8fbc-639f28ed6fa9(a)y10g2000prg.googlegroups.com>,
Andy <p7eregex(a)gmail.com> wrote:

> Hi,
>
> I am showing existing html documents in an iframe. ...
>
> What I would like to do is have a failsafe way to munge the document,
> changing it by adding margin space on the left and right of 50px each.
>

Why do you want to do this in particular? Are you wanting to improve the
original author's plan? For what purpose exactly? So it somehow stands
out better on *your* page? If so, what is the difficulty, just use your
own padding and margin on the element that contains the iFrame. Sure,
the iFrame is an inline element. But it can be the only resident of a
block element if you wish.

> My idea is that I have to parse the existing css rules for body, if
> any and save them. Then I have to insert my own div tag between
> <body> and </body> which takes the existing doc's body css and applies
> it to my inserted div. Then I have to strip all of the body css from
> the munged document, and make it have my own margins. Is this going
> to work?
>
> If so, can anyone tell me details that I've overlooked, and/or some
> example css.
>

You forgot, as usual, to give a URL of an example of "before" and, in
relation to this specific and concrete 'before', to give a detailed
description of what you would like changed.

--
dorayme
From: Ben C on
On 2009-10-24, dorayme <doraymeRidThis(a)optusnet.com.au> wrote:
> In article
><d706bcb1-9a7f-417f-8fbc-639f28ed6fa9(a)y10g2000prg.googlegroups.com>,
> Andy <p7eregex(a)gmail.com> wrote:
>
>> Hi,
>>
>> I am showing existing html documents in an iframe. ...
>>
>> What I would like to do is have a failsafe way to munge the document,
>> changing it by adding margin space on the left and right of 50px each.
>>
>
> Why do you want to do this in particular? Are you wanting to improve the
> original author's plan? For what purpose exactly? So it somehow stands
> out better on *your* page? If so, what is the difficulty, just use your
> own padding and margin on the element that contains the iFrame. Sure,
> the iFrame is an inline element. But it can be the only resident of a
> block element if you wish.

Or use marginwidth and marginheight on the IFRAME which do exactly what
the OP wants, strange though it sounds, which is effectively to put
margins on the BODY of the document inside the IFRAME.
From: dorayme on
In article <slrnhebhpn.3be.spamspam(a)bowser.marioworld>,
Ben C <spamspam(a)spam.eggs> wrote:

> On 2009-10-24, dorayme <doraymeRidThis(a)optusnet.com.au> wrote:
> > In article
> ><d706bcb1-9a7f-417f-8fbc-639f28ed6fa9(a)y10g2000prg.googlegroups.com>,
> > Andy <p7eregex(a)gmail.com> wrote:
> >
> >> Hi,
> >>
> >> I am showing existing html documents in an iframe. ...
> >>
> >> What I would like to do is have a failsafe way to munge the document,
> >> changing it by adding margin space on the left and right of 50px each.
> >>
> >
> > Why do you want to do this in particular? Are you wanting to improve the
> > original author's plan? For what purpose exactly? So it somehow stands
> > out better on *your* page? If so, what is the difficulty, just use your
> > own padding and margin on the element that contains the iFrame. Sure,
> > the iFrame is an inline element. But it can be the only resident of a
> > block element if you wish.
>
> Or use marginwidth and marginheight on the IFRAME which do exactly what
> the OP wants, strange though it sounds, which is effectively to put
> margins on the BODY of the document inside the IFRAME.

Yes, you would think this is what might do. But afaik, it looks a bit
unreliable and indefinite and seems to depend on the site embedded and
often seems to have no effect. Perhaps we might swap URLs and liven this
joint up. <g>

--
dorayme
 | 
Pages: 1
Prev: Paragraph. Em and Px
Next: Is this site hacked?