Forums

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

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

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #24694
    sant0sk1
    Member

    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:

    html:

    Code:

    *

    css:

    Code:
    #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?

    #56803
    apostrophe
    Participant

    Float your logo to the left.

    #56818
    AshtonSanders
    Participant

    Add this:

    Code:
    #title img{
    float:left;
    }

    Ashton

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