The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Programming Fundamentals" Dec 02 - 2:00 PM Eastern

2 anchors in a div: center the first, offset the 2nd

  • # April 27, 2009 at 8:58 am

    I’d like to have a horizontally centered header logo (which links to "/") and to the right of it another anchor which I’ll use for displaying help text. The idea is to have my site’s logo with an asterisk (*) next to it that can be clicked for more info.

    I have no problem performing this but the entire div is centered making the logo slightly off-center. Here is my code so far:





    #title {
    width: 400px;
    margin-left: auto;
    margin-right: auto;

    This obviously doesn’t work as it centers the entire div, but I just want to center the first anchor and have the second anchor next to it. Any ideas?

    # April 27, 2009 at 10:27 am

    Float your logo to the left.

    # April 27, 2009 at 4:08 pm

    Add this:

    #title img{


Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed