Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Want div just off center

Options
  • 23-04-2009 6:29am
    #1
    Registered Users Posts: 3,399 ✭✭✭


    Hi Lads,

    A site I'm building at the moment has one of those top login tabs, i.e. a horizontal bar with a label just underneath it with login on it.

    Soooo I'm basically setting up one 100% horizontal div and underneath that I want to add a 50px div with login in it (doing the rounded corners with jquery)

    I can make this tab centered easily but I want to make it right of center to look a bit better.

    Is this possible? or would I have to have a centered blank div of a certain width and another to the right of this?

    Thanks
    Gary


Comments

  • Moderators, Society & Culture Moderators Posts: 25,558 Mod ✭✭✭✭Dades


    When you say right of center, do you need it to be a certain distance from the right or left margin of the page? Or maybe align with something in the top tab regardless of page width?

    Can you just add a left-margin to the 50px div - enough to push it to the right where you want it?


  • Registered Users Posts: 3,399 ✭✭✭randombar


    Just a certain distance form the center, silly me if that's the case! But I'm using the margin already to center the div by setting the margin to auto??


  • Registered Users Posts: 248 ✭✭bp1989


    maybe add a few   's before the login link? These will create spaces which will push the link off centre.


  • Registered Users Posts: 3,399 ✭✭✭randombar


    Ya don't think that's it to be honest, shouldnt really have to use space padding for decent css.


  • Closed Accounts Posts: 9 galley


    Hiya,

    Can you post a link, or even a jpg of the desired effect you're looking for? I'm not sure if you want it to be centered, with a slight margin, or whether you want it to be fully to the right ...

    What if you used margin: auto, then added a padding-right/padding-left to the div? the Margin will center it, the padding will shift it in the direction you want? if you're using background images or the likes, you may need to add an outer div to set these properties to. Am I making sense to you?

    So it'll be:

    <div style="margin: auto; padding-left: 50px;">
    <div> YOUR LOGIN DIV</div>
    </div>

    Would that work for you?


  • Advertisement
Advertisement