Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Why are you using <code>display: table-row;</code> declarations ? There is no need for this. Remove the <code>display: table-row;</code> declarations, add a <code>box-sizing: border-box;</code> declaration to your textarea selector and you're all set :</p> <pre><code>.container { height: 220px; width: 220px; background-color: pink; } .container &gt; textarea { width: 100%; height: 100%; background-color: cyan; box-sizing: border-box; } .container &gt; div { width: 100%; height: 100%; background-color: cyan; } </code></pre> <p><a href="http://jsfiddle.net/b4Tt8/10/" rel="nofollow">Fiddle</a></p> <p>EDIT :</p> <p>The CSS above makes the text area overflowing its parent div.</p> <p>Here is an updated answer :</p> <h2>HTML</h2> <pre><code>&lt;div class="container"&gt; &lt;div class="button-wrapper"&gt; &lt;button&gt;X&lt;/button&gt; &lt;/div&gt; &lt;div class="textarea-wrapper"&gt; &lt;textarea&gt;&lt;/textarea&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <h2>CSS 2</h2> <pre><code>.container { height: 220px; width: 220px; background-color: pink; position: absolute; } .container textarea { width: 100%; height: 100%; background-color: rgba(255, 255, 0, 0.5); box-sizing: border-box; } .container &gt; div { background-color: cyan; } .container .button-wrapper { background-color: yellow; height: 26px; } .container .textarea-wrapper { background-color: green; position: absolute; top: 26px; width: 100%; bottom: 0; } </code></pre> <h2>CSS 3 (using calc function)</h2> <pre><code>.container { height: 220px; width: 220px; background-color: pink; } .container textarea { width: 100%; height: 100%; background-color: rgba(255, 255, 0, 0.5); box-sizing: border-box; } .container &gt; div { background-color: cyan; } .container .button-wrapper { background-color: yellow; height: 26px; } .container .textarea-wrapper { background-color: green; height: calc(100% - 26px); } </code></pre> <p>Here are fiddles that shows both solutions :</p> <p><a href="http://jsfiddle.net/pjprp/" rel="nofollow">CSS 2</a></p> <p><a href="http://jsfiddle.net/6M8nZ/1/" rel="nofollow">CSS 3</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload