iframe margin won't go away

Posted on 2006-04-19
Last Modified: 2008-01-09

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?

Question by:minnirok
    LVL 49

    Expert Comment

    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;}

    LVL 17

    Expert Comment

    Hi minnirok,

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

    Joe P
    LVL 49

    Expert Comment

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

    LVL 7

    Author Comment

    Hi guys,

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


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

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

    LVL 49

    Accepted Solution

    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') = 0;


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Suggested Solutions

    Title # Comments Views Activity
    jQuery Date picker not working 16 50
    Create a publication in Word from a HTML data 14 41
    Effect on button 11 40
    element on site jumps 4 26
    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
    In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now