开发者

in fixed width layout should i define width to element inside wrapper again like for header, footer, banner etc?

In fixed width layout if width of layout is already defined in #wr开发者_运维知识库apper {width:970px} then

what should i add to inner div which i want to expand fully .like for header, footer, banner etc

  1. same width:970px to all div also
  2. No need to define any width
  3. or width:100% should be added


Either 2 or 3..

Hardcoding the same value more than once (case 1) will only lead to trouble and more work whenever you decide to change the size of the wrapper..

And from 2 and 3, better use 2 ( as @Pablo mentioned)

  1. because it is greedy and will expand to its parent width.
  2. because you can add additional properties like border/padding/etc that affect its size, without having to make manual adjustments..


I think the correct answer is number 2.

divs by default take as much horizontal space as they can.

Anyways you might fine more detailed answers in http://doctype.com (like SO but design oriented).

Regards!

Edit: There's an interesting discussion about this topic here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜