Link to home
Start Free TrialLog in
Avatar of Doug Foster
Doug FosterFlag for United States of America

asked on

css centering and sizing buttons

I'm trying to get the buttons on my home page to be the same size and centered.  This clearly isn't my strong point.

How do i modify the css so these buttons will be forced to the same width (why is one so wide when the text isn't that wide?) and centered on the page?

Page is at

Avatar of Doug Foster
Doug Foster
Flag of United States of America image


and as a bonus, the social buttons at the bottom of the footer also should be centered.  this is in a plugin for blocks, and not the theme, unfortunately.  But maybe i can override the left justification.
Avatar of Steve Bink
Regarding the sizing of the two yellow buttons, I'm assuming the top one is "oversized" and the bottom one is sized as desired.  The difference is due to a class "aligncenter" applied to the top one, which assigns "display:block".  That makes the container, by default, take up the entire width available to it.  You can see that the bottom button is assigned "display:inline-block", which essentially "trims" it to the necessary width.  

Also, neither button has an explicit width assigned, so they will still likely not have the same size once you correct the above issue.

Regarding the placement of the buttons, look at the class "one-half", which sets an explicit left margin.  To center the buttons properly, you'll need to set "margin-left:auto;margin-right:auto" on both.  

I saw no social buttons in the footer, so cannot speak to that.
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial