Note that there are some explanatory texts on larger screens.

plurals
  1. POcss max-height inside max-height
    primarykey
    data
    text
    <p>I am trying to code a chat page but I got a problem with the sizing of the divs :/ I have a structure like this:</p> <pre><code>&lt;div class="page"&gt; &lt;div class="chat-holder"&gt; &lt;div class="chat-text"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>and the page class is (let's say the width and the height of the screen so it is </p> <pre><code>.page { width: 100%; height: 100%; } </code></pre> <p>The chat-holder I want to have a width of 740px and the height should be any height but not more than the browser height and a background white and a 20px padding around the chat area (so far I tried this):</p> <pre><code>.chat-holder { background: #fff; width: 740px; max-height: 100%; padding: 20px; box-sizing: border-box; -moz-box-sizing: border-box; } </code></pre> <p>Now my chat area I want to have a 1px black border inside this chat-holder and if the chat is not bigger than the browser minus that 40px padding, I want it to have the size of the text that is in it. If it is bigger, I want it to have scroll inside it (so far I tried this)</p> <pre><code>.chat-text { width: 100%; max-height: 100%; border: 1px solid #000; box-sizing: border-box; -moz-box-sizing: border-box; overflow: auto; } </code></pre> <p>But this doesn't work, the chat-text div goes out of the chat-holder, as i see it is because the max-height doesn't work inside a max-height. I hope there is a work-around on this issue because I really don't want to use jQuery or something to fix it.</p> <p>Thank you in advance</p> <p>EDIT: jsFiddle <a href="http://jsfiddle.net/KjX7s/2/" rel="nofollow">http://jsfiddle.net/KjX7s/2/</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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