inline-block causes the element to flows on the page in the same way inline elements do, e.g. text, img elements, etc. In many ways thing of the element as a next text character in a line of test, it will be handled in the same way.

Good for
  • Element expands as needed to fit the available text, using min-width and max-width as desired.

margin: auto

margin: auto; will not work with an inline-block.

You need to set the text alignment of the containing element to set the inline-block element alignment within it, e.g.

$HtmlOutput .= '<div style="text-align:center;"><a class="MyButton" href="/something.php">MY BUTTON TEXT</a></div>
UK Electronic Designer
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published.