开发者

How many methods (pros and cons) for a CSS fixed width center layout?

I just want some advice for this layout. I am not an experienced CSS user, so the only technique I've come across is the wrap everything into a div, set the width and auto left/right margin it. Is this method futureproof?

Any precautions or tweaki开发者_如何学Gong I should do or have knowledge of before I start? (using em for width instead of px?)

Cheers.


I highly recommend the following articles:

A List Apart: Fluid Grids http://www.alistapart.com/articles/fluidgrids/

and Smashing Magazine: Responsive Web Design: http://www.smashingmagazine.com/2011/01/12/guidelines-for-responsive-web-design/

By using a fluid grid based web design and using the responsive web design techniques, you will find that you have a lot more freedom in your design and your users will have more control over how they view your website.

I find using percentages are usually better than using a fixed width pixel base.

Cheers, Dan


Sure there are other methods but the margin:auto method is one of the easiest and it's certainly futureproof. You don't need to look for alternatives really. As for units it's nice to have fluid layouts but if images form a large component of your design it can be tricky to get it right. ems are generally better for fonts than layout since it can often get tricky to line things up without exact pixel values. Since you're new to CSS go with the easiest approach then work your way up to more complex designs.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜