Take the 2-minute tour ×

For some reason my textarea DIV is not inheriting

margin: 0 auto

from its parent:

    padding: 0;
    margin: 0 auto;

Here is a link to my CSS & HTML for this example

How can I make it so that the textarea DIV actually gets centered?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Add display:block; to textarea style. After that textarea will be treated as block element and will be displayed centered.

        resize: none;
    overflow: hidden;
    width: 460px;
    padding: 3px;   
share|improve this answer
You've brought me great joy. Thank you. –  pylonicon Aug 1 '10 at 9:04

By default, margins are not inherited. You need to specifiy margin: 0 auto; explicitly for the textarea in question. Otherwise, the containing element will be centered, but the textarea will be laid out inside the container according to the regular flow (ie., margin: 0;).

share|improve this answer
actually 'margin: 0 auto' did get inherited by the #container, .reply-box and <form>. <textarea> was the only one that did not inherit it. look at @azram19 answer for it solved my problem. –  pylonicon Aug 1 '10 at 9:10

Your Answer

