Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 667869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:58:34+00:00 2026-05-13T23:58:34+00:00

I need help to align CSS buttons. I tried many different variations and I

  • 0

I need help to align CSS buttons. I tried many different variations and I just cannot center my button the way I want.

Firstly, have a look at this url: http://www.front-end-developer.net/cssbuttons/example.htm

I’m using 2 images to form a button (this could be done on 1 image, but in this case we’ve got two). Everything works as expected as long as we apply float:left or float:right to the parent div element, to ‘limit’ width of the div and close it as soon as the content of the div ends. You can remove float:left from the button to see what I mean.

But what about center positioned buttons? I cannot add float:left/right because I want align it in the middle.

In theory, I could set

{
    width:XXpx;
    margin:0 auto;
}

And I will get what you can see on this picture:

alt text
(source: front-end-developer.net)

But I don’t know the length of the text inside. Having different translations my button can be very short, or 5 times that long.

I also tried to use <span> instead of <div>, but unfortunately nested inline elements don’t respect their padding correctly…

And yes, I must use <a> inside, so buttons can be accessed by web crawlers.

I’m really stuck on this one.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:58:35+00:00Added an answer on May 13, 2026 at 11:58 pm
    .button {display:inline-block;}
    

    Seems to do the trick.

    inline-block browser-support: http://www.quirksmode.org/css/display.html

    More about how to work around the browser issues related to inline-block:
    http://foohack.com/2007/11/cross-browser-support-for-inline-block-styling/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just need a bit of help adding a text align of center to
I need a css gunu out there to help me with this one. Right
Can somebody help me override the jquery UI css? I need to get something
I need to center the text in one of my inline-block button. How might
I need some help with some CSS coding. I have been trying to get
I need your help - I have this CSS and HTML; I need the
need help to create regular expression matching string www.*.abc.*/somestring Here * is wild card
Need help writing a script downloads data from google insight using c# this is
I need help on this following aspx code aspx Code: <asp:Label ID =lblName runat
I need help understanding some C++ operator overload statements. The class is declared like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.