WordPress.org

Support

Support » How-To and Troubleshooting » header alignment problem, in IE vs. firefox

header alignment problem, in IE vs. firefox

  • I can’t seem to get my header to be lined up right in BOTH firefox and IE. In IE it’ll be one pixel to the left, in firefox one pixel to the right.

    I can get one or the other to look right, but fixing it in one immediately breaks it in the other. Here’s what I have right now:

    from style.css:

    #header {
    padding: 0;
    margin: 0 auto;
    height: 200px;
    width: 100%;
    background-color: #73a0c5;
    }

    #headerimg {
    margin: 0;
    height: 200px;
    width: 100%;
    }

    from header.php:

    #header { margin: 0 !important; margin: 0 0 0 0; padding: 0px; height: 200px; width: 758px; }
    #headerimg { margin: 0 1px 0; height: 198px; width: 740px; }

    The theme is chinared and the page can be found at http://www.eastasiawatch.com

    If I change
    #headerimg { margin: 0 1px 0; height: 198px; width: 740px; }
    to “#headerimg { margin: 0 0px 0; height: 198px; width: 740px; }”
    it’ll work in firefox, but immediately be off one pixel in IE. I’d appreciate any help. I’ve seen a couple of people w/ similar problems on the forum, but they’re all still unresolved.

Viewing 3 replies - 1 through 3 (of 3 total)
  • bueller?

    I figured out a workaround – I’m using php to detect which browser someone is using. If it’s IE, they’ll see the #headerimg that works for IE and vice versa if they’re using another browser:

    <?php
    function inAgent($agent) {
    global $HTTP_USER_AGENT;
    $notAgent = strpos($HTTP_USER_AGENT,$agent) === false;
    return !$notAgent; }
    if ( inAgent(‘MSIE’) ) { $browser = ‘ie’; } ?>
    <?php if ($browser == ‘ie’): ?>
    #headerimg {margin: 0px 1px 0px; height: 200px; width: 760px; }
    <?php else: ?>
    #headerimg {margin: 0px 0px 0px; height: 200px; width: 760px; }
    <?php endif; ?>

    hope this points someone else in the right direction if they have a similar problem.

    just what i needed. thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘header alignment problem, in IE vs. firefox’ is closed to new replies.