Link to be turned into a button:
  <a class="MyButton" href="/my_page.php">My Button Text</a>
CSS

a.MyButton, a.MyButton:hover, a.MyButton:visited {
  background-color: #F8F8F8;
  border: 1px solid #e6e6e6;
  border-radius: 4px 4px 4px 4px;
  display: inline-block;    /*inline-block so width will auto expand if needed*/
  min-height: 36px;
  min-width: 100px;
  padding-top: 6px;
  padding-right: 6px;
  padding-left: 6px;
  padding-bottom: 6px;
  margin-top: 8px;
  margin-right: 8px;
  margin-left: 0px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: normal;
  line-height: 40px;
  color: #444444;
  text-align: center;
}

Align button left / right / center

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

You need to set the text alignment of the containing element to set the alignment, e.g.

$HtmlOutput .= '<div style="text-align:center;"><a class="MyButton" href="/something.php">MY BUTTON TEXT</a></div>

Centre align a group of buttons

Put the buttons inside: <div class=”MyButtonContainer”></div>

.MyButtonContainer {
  margin-top: 10px;
  margin-bottom: 10px;
  
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}
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.