How to center any element in HTML : <p>I want to center <code>textarea</code> element, but <code>margin: 0 auto</code> doesn't work properly.</p>

<p>Also I tried to wrap element in <code>div</code> which has <code>margin: 0 auto</code> style.</p>

<pre><code>&lt;div style="margin: 0 auto;"&gt;
    &lt;textarea rows="4" cols"100"&gt;&lt;/textare&gt;
&lt;/div&gt;
</code></pre>
