View Full Version : borderlayout question

24 Oct 2006, 5:04 PM
Ok, I have this code...

Layout = {
init: function() {
var layout = new YAHOO.ext.BorderLayout(document.body, {
north: {
initialSize: 35
south: {
initialSize: 20,
center: {
autoScroll: true
layout.add('north', new YAHOO.ext.ContentPanel('header', {fitToFrame:true}));
layout.add('south', new YAHOO.ext.ContentPanel('footer', {fitToFrame:true}));
layout.add('center', new YAHOO.ext.ContentPanel('content', {title: "body", fitToFrame:false}));

Any content I put into the div "content" is inheriting a setting of 100% width from somewhere. Is this the expected behaviour?

24 Oct 2006, 5:57 PM
The content of the div 'content' (this may get confusing :) ) shouldn't get adjusted at all. But 'content' (the div) is a block element, and by default block elements expand to fill their container. Does that make sense?

24 Oct 2006, 5:58 PM
Note: They expand their width, but not height.

24 Oct 2006, 6:33 PM
elements within the block appear to be getting assigned as blocks as well...

nice thing about the new framework I'm working with... I don't have much done so it was easy enough for me to throw together a demo for you. I set red borders around the children blocks so you can see how they're getting stretched. Happening in north and south also.


25 Oct 2006, 6:50 AM
Your child element is a div. A div is a block element. It will automatically grow it's width to fill it's parent element.

25 Oct 2006, 9:01 AM
ugh, i just did a test using basic html and see you're 100% correct, I have no idea why I was thinking a div's width was adjusted to fit that of it's content... Sorry about that Jack.

25 Oct 2006, 3:40 PM
It's much better to ask questions than to just think somethings broken. I am guilty of giving up on something many times rather than asking a question.