Previous Message
Next Message

to container/wrapper or not to container/wrapper

Sent by Donna Casey on 23 August 2005 01:01


4css!!!! wrote:
> This just came up today on a forum I visit, question was in regards to using 
> a container/wrapper when doing your designs, if so, what would the reasons 
> be, if not why not, is this just for certain layouts, fixed and fluid, just 
> fixed, just floats etc..

well, I'd say it's kind of like bringing home the groceries - if you've 
got a car, then why use bags? --because it is easier to take them manage 
the groceries - taking them inside, organizing different types of 
groceries, keeping them cold...

kidding aside, it 1) eliminates redundant attributes, particularly with 
positioning, because all inner containers can be influenced by the 
wrapper's own positioning; 2) allows grouping of inner elements; and 3) 
adds specificity.

1) In some cases, it's an absolute necessity - for example, if trying to 
position inner divs relatively or absolutely to something other than the 
body of the page.

2) Or if you want to center a fixed width layout - the outer wrapper div 
makes it possible to apply the auto value to the left and right margin 
and all the inner elements stay properly centered.

3) Plus, it gives you yet another ID (high specificity) you can tap into 
should the occasion warrant it.

You could generate a huge list of this layout and that layout needs or 
doesn't need a wrapper div, but the general advantages are mostly the 
ones above...however they apply to a specific layout.

There's probably a better way to say it, but that's how I look at it.

Donna


______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: