WordPress.org

Ready to get started?Download WordPress

Forums

header alignment problem, in IE vs. firefox (4 posts)

  1. hunteramor
    Member
    Posted 8 years ago #

    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.

  2. hunteramor
    Member
    Posted 8 years ago #

    bueller?

  3. hunteramor
    Member
    Posted 8 years ago #

    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.

  4. greeenkaos
    Member
    Posted 8 years ago #

    just what i needed. thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic