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>
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *