layout 布局

<b>http://blog.html.it/layoutgala/#details
Layout Gala: a collection of 40 CSS layouts based on the same markup and ready for download!</b>

Layout Gala

Go to the italian version - vai alla pagina in italiano
by Alessandro Fulciniti

In November 2005 I presented on pro.html.it a three-part article on creating CSS layouts using techniques like negative margins, any order columns and in some case opposite floats. The main goal of the article was getting the maximum number of layouts based on the same markup, each with valid CSS and HTML, without hacks nor workaround and a good cross-browser compatibility. The result is a set of 40 layouts that we've thought worth sharing: on each of them you'll find also a download link (if you want, you can download the entire collection, 40 HTML pages in a single zip file). Further details can be found below the gallery.

Further details

All layouts use valid markup and CSS, and have been tested successfully on Internet Explorer/win 5.0, 5.5, 6 and beta 2 preview of version 7; Opera 8.5, Firefox 1.5 and Safari 2. Each of the columns could be the longest, and for testing columns length I've used the script filler text on demand.

Each layout could represent a site with five main sections: header, content, navigation, other stuff and footer. The basic markup, common to every layout, is the following:

<div id="container">
  <div id="header">Header</div>
  <div id="wrapper">
    <div id="content">Content</div>
  </div>
  <div id="navigation">Navigation</div>
  <div id="extra">Extra stuff</div>
  <div id="footer">Footer</div>
</div> 

It's almost minimal, apart from an extra wrapper around the content. Some might argue that the extra div it's unsemantical: all I can say is that in my opinion an extra wrapper in the markup is certainly better than CSS hacking, and to be able to meet the objectives I fixed for the article I needed at least a solid starting point.

Talking about CSS: each of the layouts uses float and in most of the cases negative margins. Once you've understand how they work, they are really simple and powerful. There are two main things to know: first, a negative margin according to the side of float has the effect of shifting even more the floated elements towards the side of float; the second one is that a negative margin on the opposite side of float does not affect the floated element position, but has the only effect to yeld space for eventual flanking element on the side of the negative margin.

The CSS of the examples, which is embedded in both online and download versions, has been kept to the minimum in order to focus on the most important thing, as is the layout. In fact, the CSS has been divided, with an empty line, between two logical parts: the first is for typography and colors, while the second and most important is for the layout itself. No graphics was used in the examples, but if you'll feel the need, you may want to apply techniques such as Faux Columns and Sliding Faux Columns. That's all for now: enjoy!



posted on 2011-08-28 20:49  lexus 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/lexus/archive/2011/08/28/2156379.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值