iframe margin won't go away

Hi,

I have an empty iframe to which I'm writing text. There is a margin inside the iframe which I can't seem to get rid of. I defined it like:

<iframe id = "something" name = "something" frameborder="0" style="position:absolute; left:5px; top:120px; width:157px; height:310px; border:1px solid black;" marginheight="0px" marginwidth="0px" src="about:blank"></iframe>

So the left margin looks good, it is really 0px - but the top margin is still like 10px, the right margin the same, 10px.

Can I get rid of it?

Thanks
LVL 7
minnirokAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RoonaanCommented:
The margin inside the frame you can remove by setting the below style to the document you LOAD INTO the iframe:

<style type="text/css">
body,html {margin:0;padding:0;}
</style>

-r-
0
BogoJokerCommented:
Hi minnirok,

Wow you are up early Roonaan!  Isnt it like 6 in the morning?

Joe P
0
RoonaanCommented:
Yes it is, I have to go to work today, which is about 2,5 hours travel to Amsterdam :-)

-r-
0
minnirokAuthor Commented:
Hi guys,

I'm not loading any document though into the iframe, it's just:

    src="about:blank"

then I can type text in there with designMode = 'on'.

I'm new at iframes so if I misunderstood please let me know,

Thanks
0
RoonaanCommented:
Then the only thing I can offer you is to try:
<iframe id = "something" name = "something" frameborder="0" style="position:absolute; left:5px; top:120px; width:157px; height:310px; border:1px solid black; margin:0;padding:0" src="about:blank"></iframe>

Or try setting this thru javascript: document.getElementById('something').document.body.style.margin = 0;

-r-
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.