Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Weird error - space at top of page

  • 11-03-2010 10:18am
    #1
    Registered Users, Registered Users 2 Posts: 387 ✭✭


    I'm developing a drupal site using the zen theme as a base. I have a weird issue where there is a space of 22px at the of the page that I can't get rid of. In trying solve the issue I deleted almost everything from my page.tpl.php file but the problem still exists. Here is what my page.tpl.php file looks like now -
    <head>
    </head>
    <body style="margin:0; padding:0">
    <div>
    Why is there a space above this?
    </div>
    </body>
    </html>
    
    Here are two images showing the space that I can't get rid of -

    4rom68.jpg



    2zp6oeq.jpg



    I also took the html code in my page.tpl.php file and pasted it into a new test.html file and opened it with firefox and it worked fine with no space. As you can see, no space between the text and the top of the page -
    2a0jejc.jpg
    The only difference between the test.html file and my page.tpl.php file is that drupal adds
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    
    into the tag.

    Anyone got any ideas for me as I am at a loss at the moment.

    I've also just noticed that if you compare the images you can see that in the page.tpl.php file there is actually a space in the firebug display between the <body> tag and the <div> tag, whereas in the test.html there is no space - if that gives any clue as to what is going wrong?


Comments

  • Registered Users, Registered Users 2 Posts: 7,838 ✭✭✭Nulty


    attach a reset style sheet and see if that works. You might be able to track down the problem by playing around with it.
    <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/reset/reset-min.css">
    


  • Registered Users, Registered Users 2 Posts: 387 ✭✭gimme5minutes


    It's something very weird. If I delete everything in my template.php file except for the <?php tag at the start the space still exists. As soon as I delete the <?php tag, leaving template.php empty, the space goes. How a <?php tag can put a space there I haven't a clue.


  • Registered Users, Registered Users 2 Posts: 1,802 ✭✭✭cormee


    Not sure but can suggest two things

    Your page might be inheriting the padding/margin from somewhere else (unlikely but possible)

    Try adding !important after both margin:0; padding:0 so they become

    margin:0!important; padding:0!important;

    If that doesn't work download Firebug for Firefox and mess around with the CSS in a live view. Download Firebug anyway, it's a lifesaver.

    **Edit - I see from your screengrabs you already have Firebug :)


  • Registered Users, Registered Users 2 Posts: 387 ✭✭gimme5minutes


    Fixed it by creating a new template.php file and copying the contents of the old one directly back into it. I think the problem was down to a text encoding issue as I changed the encoding to ANSI at one stage and then back to utf.


Advertisement