Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other [Solved] Header image won't center when language selector box added

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #187179
    sfoshee
    Participant

    I added a WPML language selector to the top right of my page using the following code:
    <div style="float: right;"><?php do_action('icl_language_selector'); ?></div>

    I need it to be on the same line as the header image, not taking up any more lines on the page. It worked, except that it moved the header image over so it is not centered anymore. Both the header image and the language selector box look small enough to fit next to each other, but still the center is offset on the header image. I keep playing with it, but can’t get it right. Please, does anyone have any ideas to help? Here is a representative page:
    http://lallabee.com/wordpress/?page_id=41

    Thank you for your help!

    #187182
    Paulie_D
    Member

    I wouldn’t float the language selector for the very reason you have just discovered.

    Instead,

    
    .site-header {
    margin: 0 auto;
    position: relative; /*add this */
    }
    

    Then the language selector should be positioned absolutely. The div has no ID but I’m sure you know which one it is.

    
    /* float: right; */ /* remove this */
    position: absolute;
    right: 0;
    }
    
    #187191
    sfoshee
    Participant

    Thank you. I’m sorry but I’m confused. Which code should I add, the top or the bottom or both? Does it go in the edit CSS section? Here is the code to insert the language selector <?php do_action('icl_language_selector'); ?>

    Thank you so much!

    #187193
    sfoshee
    Participant

    So add this in the Edit CSS section:
    `
    .site-header {
    margin: 0 auto;
    position: relative;
    }

    `
    And then add this where I had it before in the Header.php file:
    <div style="position: absolute; right: 0;"><?php do_action('icl_language_selector'); ?></div>

    Is that right?

    #187196
    sfoshee
    Participant

    I just inserted <div style="position: absolute; right: 0;"><?php do_action('icl_language_selector'); ?></div> in the Header.php file and that seemed to do the trick. Should I still add the `.site-header {
    margin: 0 auto;
    position: relative;
    }

    ` in the Edit CSS section?

    #187201
    sfoshee
    Participant

    OK, I think that has it. Thank you very much for your help!

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Other’ is closed to new topics and replies.