title: Center CSS Button with width auto
body: <p>I want to have a button with <code>width:auto;</code> and <code>display:block;</code>. This button should be centered with <code>margin:0 auto</code>. But if I take all together, it will not work.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>CODE:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;asd&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  I am an example content and I should be above the button. I want to have an auto width and being centered
  &lt;style type="text/css"&gt;
      .btn{
              color:black;
              font-size: 14px;
              line-height:14px;
              text-align: center;
              font-weight: bold;
              margin:0 auto;
              height:14px;
              display:block;
              cursor: pointer;
              background-color:red;
              padding:15px;
              text-decoration:none;   
      }
  &lt;/style&gt;
  &lt;a class="btn"&gt;helloworld&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>