#1
  1. Plays with fire
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2003
    Location
    Barsoom
    Posts
    960
    Rep Power
    97

    Really stupid problem


    Hi--

    I'm pretty sure this is a PHP problem, but it may be related to CSS.

    I'm creating three columns on a page and in one column I'm using a PHP include_once() statement for subnav. The trouble is, when including a file into a parent div, the child div has a margin on the top. See the attached JPG for a look at what's happening.

    Here's my code:

    PHP Code:
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="utf-8">
    <style>
            * { margin: 0; padding: 0 }
        #one {float: left; width: 200px;}
        #two {float: left; width: 200px;}
        #three {float: left; width: 200px;}
        .b {border: 1px solid #0f0;}
    </style>
    </head>

    <body>
    <div id="one"><div class="b">ONEONEONEONEOEN<br><br>oneoneone</div></div>
    <div id="two"><?PHP include_once("../includes/cassidy.inc");?></div>
    <div id="three"><div class="b">33333333333</div></div>
    </body>
    </html>
    Here's the include:

    PHP Code:
    <div class="b">twotwotwotwotwo</div
    If I place the parent div in the included file it works fine and I suppose I could use that as a workaround, but prefer not to.

    Any ideas?




    UPDATE: It works fine on an older server, but not a new one. Any idea what to look for? It's on a Windows server with Apache.
    Attached Images
    Last edited by Frank Grimes; May 10th, 2013 at 03:08 PM.
    “Be ashamed to die until you have won some victory for humanity.” -- Horace Mann

    "...all men are created equal." -- US Declaration of Independence
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,295
    Rep Power
    9400
    Maybe this isn't a CSS issue after all...

    What do you see with a View Source? It's the output of the PHP that matters.
  4. #3
  5. Plays with fire
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2003
    Location
    Barsoom
    Posts
    960
    Rep Power
    97
    The source looks exactly the same as the pasted code.

    I'm using UltraEdit to create docs and I'm saving with UTF-8 NO BOM.


    Edit: Well, crap. Turns out my include file was a problem. Resaving it with NO BOM fixed it, but it doesn't explain why it works on the old server just fine.

    Man, programming is hard!
    Last edited by Frank Grimes; May 10th, 2013 at 03:19 PM.
    “Be ashamed to die until you have won some victory for humanity.” -- Horace Mann

    "...all men are created equal." -- US Declaration of Independence

IMN logo majestic logo threadwatch logo seochat tools logo