Adjustable width for browser size
# April 21, 2013 at 5:03 pm
I have a div that needs to adjust its width when the browser is not tall enough to show the whole div. Here’s an example http://codepen.io/anon/pen/ivlHr
What I need is when you make the browser window shorter, the .post will shrink and then get wider to fit everything. Hopefully I am being clear.
Thanks in advance!# April 21, 2013 at 7:45 pm
You could use a percentage value and `box-sizing` which is supported by IE9+ and all modern browsers, IE8 has some support for it but it is buggy.
Given that your example doesn’t change and you only have 3 boxes per row the following example will work just fine.
http://codepen.io/ChrisUpjohn/pen/pJzGn# April 22, 2013 at 6:23 am
Possibly, but it sounds as though the content must be 100% visible at all times regardless of the width/height of the viewport.
From what I can gather both of the dimensions must be flexible and I’m not sure that is something that is possible without JS.
If we assume that the content box is say 80% of the vh (viewport height) [to allow for some padding / margins etc] then the width **could** be flexible but how do you add more horizontal post divs and maintain a flexible width..unless we side-scroll.
Hmmm…might be interesting.
You must be logged in to reply to this topic.