html, body, div, span,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
img, ins, kbd, q, s, samp,
small, strike, strong,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baselinebaseline;
background: transparent;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
Thursday, September 17, 2009
Use a CSS Reset Before Start
CSS resets: to use or not to use; that is the question. If I were to offer my own personal advice, I'd 100% recommend that you create your own reset file. Begin by downloading a popular one, like Eric Meyer's, and then slowly, as you learn more, begin to modify it into your own. If you don't do this, you won't truly understand why your list items are receiving that extra bit of padding when you didn't specify it anywhere in your CSS file. Save yourself the anger and reset everything! This one should get you started.
9 CSS3 Properties You Can Use Now
If you’ve looked at any of the stuff to be included in CSS3, you were no doubt bouncing off the walls in excitement until you remembered how long it tends to take some browsers to support that kind of stuff.
But some good news: Quite a bit of this CSS3 awesomeness can be used right now to spice up your designs. Some (most) of it will not render in all browsers equally (generally those of the IE variety), but websites don’t need to look the same in every browser–nor should they. Just because IE6 users can’t see some fancy effect doesn’t mean everybody shouldn’t. Similar to how those watching TV on a standard television will not be able to see HD, users on older browsers need not get the same experience as those on newer browsers as long as they see nothing wrong with the site.
But enough ranting and onto the good part. CSS3 properties you can use now and how to use them:
For a text-shadow, the property is used as follows:
The first and second values represent the shadow offset, the third the blur radius, and the last value the color of the shadow.
For tips on effectively using shadows in your designs, check out one of my previous articles, The Shadow World: CSS3 Text-Shadow and Reality.
Browser support for
The first two values are the offset of the shadow, the third the blur radius, and the fourth value the spread radius. The last value is, of course, the shadow color.
Browser support for
The
In properly-behaving browsers, all elements are displayed as
However, by declaring the
Browser support for
This tells the element that you want the content displayed in 2 columns, each 250px wide. Either of these values can also be set to
But what if you want custom gutter sizes and dividers? No problem, as we have
This will place a 25px gap between our columns with a 1px solid black line running down the middle of the gap. There’s even more you can do with CSS3 columns, and I’d recommend that those interested checking out this article for more goodness.
Browser support for
For slightly more advanced usage (using on only select corners), check out this excellent article.
Browser support for
Basically, the property declares an image to be used before telling the browser how to clip and stretch different sections of it. Check out his full article for more examples and details.
Browser support for
To embed a font, simply add an
This tells the browser that whenever the font “My Awesome Font” is used, pull it from “MyAwesomeFont.otf.” Simple and brilliant, really. So then to use our font, we just declare like we would any other font:
There are a couple things to note, however. Firstly, and most importantly, make sure the font you are using has a license that allows font embedding. There’s a fairly decent list of legal fonts over here, and Typekit will be another solution that looks promising.
The other thing to note: Fallbacks. Cufón and typeface.js are both good options for when
Browser support for
This works identically to RGB color with the addition of a fourth parameter declaring opacity. So, if you want to create a black background with 50% opacity, simply do the following:
While this (of course) will not work in IE, there’s a great (though slightly complicated) article on creating bulletproof, cross-browser RGBA backgrounds using some filters and PNGs.
Browser support for
The
These transitions can be applied to any property (and even multiple ones at the same time!), such as padding and background, for instance:
For more advanced usage, check out the Webkit blog.
But some good news: Quite a bit of this CSS3 awesomeness can be used right now to spice up your designs. Some (most) of it will not render in all browsers equally (generally those of the IE variety), but websites don’t need to look the same in every browser–nor should they. Just because IE6 users can’t see some fancy effect doesn’t mean everybody shouldn’t. Similar to how those watching TV on a standard television will not be able to see HD, users on older browsers need not get the same experience as those on newer browsers as long as they see nothing wrong with the site.
But enough ranting and onto the good part. CSS3 properties you can use now and how to use them:
1. Text-shadow
Thetext-shadow property is probably one of the most commonly used aspects of CSS3, likely because of it’s extremely easy setup (it’s almost too easy…).For a text-shadow, the property is used as follows:
text-shadow: 2px 2px 5px #000;For tips on effectively using shadows in your designs, check out one of my previous articles, The Shadow World: CSS3 Text-Shadow and Reality.
Browser support for
text-shadow: Safari 3.1+, FireFox 3.5, Chrome 2.0+, Opera 9.6+2. Box-shadow
Thebox-shadow property is used in a way very similar to text-shadow, but it adds shadows to the elements as a whole rather than to the text inside them: box-shadow: 5px 5px 10px 10px #000;Browser support for
box-shadow: Safari 3.1+, FireFox 3.5, Chrome 1.0+3. Box-sizing
Thebox-sizing property is one of the most under-appreciated yet widely-supported properties in the CSS3 spec. The
box-sizing property is quite simple, and it accepts three possible values: content-box, border-box, or inherit. This declares how an element’s size is to be rendered:box-sizing: content-box | border-box | inherit;content-box by default — padding and borders are rendered outside the specified width and height, so an element with a width of 20px with a 1px border and 5px of padding will actually be rendered as 32px wide (20 + 1 + 1 + 5 + 5). However, by declaring the
box-sizing property to border-box, the padding and borders are rendered inside the element. So, our example from earlier would be 20px wide total, with 10px of that element taken up by borders and another 2px taken by padding. This can be extremely useful when using percentage-based widths in your layouts. Browser support for
box-sizing: IE8+, Safari 3.1+, FireFox 2.0+, Chrome 1.0+, Opera 9.6+4. Columns
Thecolumns property is also fairly easy to setup and makes for great magazine-style layouts. Both Mozilla and Webkit browsers require prefixes before the property, so setting an element to render its content in multiple columns works as follows: -moz-column-count: 2; /* For FireFox */
-webkit-column-count: 2; /* For Safari/Chrome */
column-count: 2; /* For when the standard gets fully supported */
-moz-column-width: 250px; /* For FireFox */
-webkit-column-width: 250px; /* For Safari/Chrome */
column-width: 250px; /* For when the standard gets fully supported */
auto, which allows it to be determined based on what best fits with the other value. But what if you want custom gutter sizes and dividers? No problem, as we have
column-gap and column-rule coming to the rescue: column-gap: 25px;
column-rule: 1px solid #000;
-moz-column-gap: 25px;
-moz-column-rule: 1px solid #000;
-webkit-column-gap: 25px;
-webkit-column-rule: 1px solid #000;
Browser support for
columns: Safari 3.1+, FireFox 3.5, Chrome 1.0+5. Border-radius (rounded corners)
Because everybody likes rounded corners, the CSS3 spec contains the popularborder-radius. Mozilla and Webkit browsers require their standard prefixes, so to add rounded corners with a 10px radius to an element, use the following:-moz-border-radius: 10px; /* For FireFox */
-moz-border-radius: 10px; /* For Safari/Chrome */
border-radius: 10px; /* For when the standard gets fully supported */
Browser support for
border-radius: Safari 3.1+, FireFox 2.0 (non-antialiased), FireFox 3.0+, Chrome 1.0+ (non-antialiased)6. Border-image
Theborder-image property is not used nearly as much as border-radius (probably because the syntax is somewhat hard to understand). However, it can be used for some awesome effects and John Resig provides a fairly good explanation of how it can be used through the following example:-webkit-border-image: url(whiteButton.png) 0 12 0 12 stretch stretch;
-moz-border-image: url(whiteButton.png) 0 12 0 12 stretch stretch;
Browser support for
border-image: Safari 3.1+, FireFox 3.5, Chrome 1.0+7. @font-face (web font embedding)
While not technically a property, the CSS3@font-face declaration has been receiving quite the attention as of late. Håkon Wium Lie, the original proposer of CSS, wrote a must-read article for A List Apart all about @font-face. Essentially, this allows developers to embed fonts in their pages that can be called by the simple font-family property. To embed a font, simply add an
@font-face declaration as follows:@font-face {
font-family: "My Awesome Font";
src: url(MyAwesomeFont.otf) format("opentype");
}
h1 { font-family: "My Awesome Font", sans-serif; }The other thing to note: Fallbacks. Cufón and typeface.js are both good options for when
@font-face isn’t supported. Kilian Valkhof has a great article on combining Cufón and @font-face.Browser support for
@font-face: Safari 3.2+, FireFox 3.5, Chrome 2.0+, IE4+ (sort of)8. RGBA color
While actually a value and not a property,rgba() is also worth mentioning (and using!). While generally colors have been declared using hex values (e.g., #000000 for black) or RGB values (rgb(0,0,0) for black), CSS3 has now added a new option: RGBA. This works identically to RGB color with the addition of a fourth parameter declaring opacity. So, if you want to create a black background with 50% opacity, simply do the following:
background: rgba(0, 0, 0, 0.5)Browser support for
rgba() (without filters): Safari 3.1+, FireFox 2.0+, Chrome 1.0+9. Transitions
Ever wished you could do transition effects with CSS? Well, now you can using the CSS3transition property. Webkit browsers (mainly Safari and Chrome) currently support it and do so with the -webkit- prefix: #element {
opacity: .7;
-webkit-transition: opacity 1s linear;
}
#element:hover {
opacity: 1;
}
transition property is actually shorthand for transition-property, transition-duration, and transition-timing-function. Our example code above thus tells the browser that when #element’s opacity changes, do a 1-second linear transition. These transitions can be applied to any property (and even multiple ones at the same time!), such as padding and background, for instance:
#element {
background: #000;
padding: 5px;
-webkit-transition: background 1s linear;
-webkit-transition: padding 1s linear;
}
#element:hover {
background: #FFF;
padding: 20px;
}
Go and use the future!
CSS3 brings some awesome stuff to the table, and now is the time to start using it. As the web development community gets more and more excited about CSS3, Mozilla and Webkit browsers are quickly adding more and more support for new properties, declarations, and selectors. So take advantage of it!Wednesday, September 16, 2009
中国互联网十五年的22个创新模式
今天,看网上有人推荐《沸腾十五年》,讲中国互联网从发源到现今。
有人有如此梳理,自己本来也想梳理一下中国互联网这么多年,到底是哪些公司出来了,为什么会是他们出来了。他们的出来代表着什么趋势,他们一串串的连接闪现不同类型的公司有不同的潮流,到底暗示着什么趋势。下一个趋势是什么?当时他们出现的历史环境是什么?以后会不会再出现那样的环境? 抱着这么多问题,开始阅读。并梳理了一个总结。
你跳不开论坛。这是中国互联网的发源。交互,多人交互,集市。不管是邮件、IM、博客、twitter、QQ群、贴吧、圈子、同学录均是如此变种。现在论坛,能想起的只有天涯。感叹天下社会芸芸众生的悠悠草根生活,生活自嘲与智慧跃然帖子。想足不出户了解中国老百姓的心理和现状,天涯不能不去。
第二个就是新闻。搜狐对应白领,网易对应华南,QQ对应90后,新浪对应老百姓。就是一个电子媒体,有内容看内容,有人气卖广告。
第三个是QQ。很多人上网,学会上网和打字,引发安装宽带的需求,就是因为QQ。
第四个就是SP,彩铃、短信。没有SP,中国互联网第一批弄潮儿估计会成为先烈。FLASH连带彩图火了好一阵,但也没赚到什么钱,有热闹有观众,没钱。
第五个就是51JOB。在2002年还有人讨论招聘会和线上收简历的优缺点。2003年就根本没有人讨论这个问题了,因为大家都网上收发简历了。
第六个就是搜索。各种垂直搜索都各项争霸,如今谁惨淡,谁崛起呢?好似没看见崛起的。还是百度谷歌。虽然搜狐、网易、腾讯、阿里都要自己开发搜索引擎。但没崛起。不知道
第七个就是迅雷。迅雷的多点下载思路很创新。网络蚂蚁被flashget干掉,快车又被迅雷干掉。中间还夹杂电驴电骡之类。
第八个就是3721。不要打啊。企业现在都缺推广。百度是推广,新浪是推广,阿里是推广。返现,阿里妈妈、太极链。都要推广。当然,还藏着一个discuz,也是推广。大家也能联想到挂马、盗号、肉鸡,流氓插件、绿色软件。争做浏览器抢占用户窗口,争着占领用户电脑右下角。输入法也是这个意思。
第九个和3721也很有关联,就是导航站。hao123,265。大家也能想到域名买卖、虚拟主机、流量统计、SEO、推广、邮件群发、黄页、连锁加盟黄页网、阿里巴巴、做网站公司、五洲在线、6688。
第十个不能不提google邮箱,启动快速、无限量、搜索准确、邮件反复回复关联强。尤其推荐口碑营销邀请加入,够创新。
第十一个是游戏。这就不说了。征途的虚拟装备和地推和逢年过节的随机掉宝新任务、QQ的虚拟装备和Q币、盛大的计时计费和点卡渠道。高。创新的非常好。
第十二个是好耶。当然也关联着分众,以及N多各个细分行业的分众们。但好耶和分众还不太一样。分众是自己在新的地皮上开辟新疆土,而好耶不仅做互联网窄告这一创新模式,好耶还是大代理商,如同携程。
第十三个是携程。这是个好模式。携程属于票务,但和演出票还不一样没有过期作废性,而且消费群体更大。携程的地推模式、呼叫中心模式、现在在机场深度拉人模式,都值得学习。
第十四个是当当。当当、卓越、京东、红孩子、麦网等等,从网站、呼叫中心、目录邮购、仓储、配送,都在低调受苦受累的做。他们是一类。
第十五个是淘宝、阿里。太独,太份额大,所以很难找到类比。他们不进货不压货不卖货,只搭建平台。
第十六个是支付宝。没有它,电子商务的接受规模可能远远小于现在。推动中国电子商务行当做大,它功不可没。
第十七个是黄页、加盟网、阿里巴巴。这是B2B的主要模式。你对比对比,你就知道B2B该怎么走了,为什么只能这么走,这么走还有哪些缺陷,如何更小成本更容易的解决这些缺陷,你有创新性的思维吗?
第十八是视频网。过去很多年前想收藏的《义不容情》《雍正皇帝》《八月桂花香》《大长今》《商道》都能随时看了。但就是不知道怎么赚钱,而烧钱却非常快。GOOGLE收了youtube,也没辙。流量很高,但收入怎么来?
第十九个是社区、SNS、WEB2.0,也包括同学录。从这里还能引申想到社会化商务、点评、豆瓣,还能想到flash小游戏、摩尔庄园、4399等等。哦,还有盒子。
第二十个是和生活相关的。从分类信息和点评引发,最后出来爱帮、地图,也和垂直搜索、电子商务有些关联。谁还能记起分类网站?各种拼车网站?大别针换房子?
第二十一个是口碑营销引发。有个专门的人肉搜索、刷流量、刷信用、刷评论等等专业小公司。有本书叫众包。就是这个意思。这是一种新模式。我还想起威客网,大家现在谁记得?盈利模式哪里不对劲?在什么环境下可以成功?
第二十二个是移动互联网。移动QQ流量最大,然后是看新闻、看电子小说、查地图、搜索。决斗聊天、搜索、浏览器、导航、新闻、地图、生活搜索。
每一个都是独特的,每一个都是鲜活的。每一个都是创新的。下一个,是谁加谁,谁联合谁然后变种成了什么?移动+生活+地图+IM+支付+电子商务(淘宝、vancl、携程、当当)(网站、呼叫中心、短信、邮件、目录邮购、仓储、配送、地推)+社区(点评、贴吧、QQ群、微博)?还得是人气+广告、人气+卖实物东西、好玩+虚拟装备、收集数据清洗数据保鲜数据卖数据统计数据分析数据+付费,你看呢?
有人有如此梳理,自己本来也想梳理一下中国互联网这么多年,到底是哪些公司出来了,为什么会是他们出来了。他们的出来代表着什么趋势,他们一串串的连接闪现不同类型的公司有不同的潮流,到底暗示着什么趋势。下一个趋势是什么?当时他们出现的历史环境是什么?以后会不会再出现那样的环境? 抱着这么多问题,开始阅读。并梳理了一个总结。
你跳不开论坛。这是中国互联网的发源。交互,多人交互,集市。不管是邮件、IM、博客、twitter、QQ群、贴吧、圈子、同学录均是如此变种。现在论坛,能想起的只有天涯。感叹天下社会芸芸众生的悠悠草根生活,生活自嘲与智慧跃然帖子。想足不出户了解中国老百姓的心理和现状,天涯不能不去。
第二个就是新闻。搜狐对应白领,网易对应华南,QQ对应90后,新浪对应老百姓。就是一个电子媒体,有内容看内容,有人气卖广告。
第三个是QQ。很多人上网,学会上网和打字,引发安装宽带的需求,就是因为QQ。
第四个就是SP,彩铃、短信。没有SP,中国互联网第一批弄潮儿估计会成为先烈。FLASH连带彩图火了好一阵,但也没赚到什么钱,有热闹有观众,没钱。
第五个就是51JOB。在2002年还有人讨论招聘会和线上收简历的优缺点。2003年就根本没有人讨论这个问题了,因为大家都网上收发简历了。
第六个就是搜索。各种垂直搜索都各项争霸,如今谁惨淡,谁崛起呢?好似没看见崛起的。还是百度谷歌。虽然搜狐、网易、腾讯、阿里都要自己开发搜索引擎。但没崛起。不知道
第七个就是迅雷。迅雷的多点下载思路很创新。网络蚂蚁被flashget干掉,快车又被迅雷干掉。中间还夹杂电驴电骡之类。
第八个就是3721。不要打啊。企业现在都缺推广。百度是推广,新浪是推广,阿里是推广。返现,阿里妈妈、太极链。都要推广。当然,还藏着一个discuz,也是推广。大家也能联想到挂马、盗号、肉鸡,流氓插件、绿色软件。争做浏览器抢占用户窗口,争着占领用户电脑右下角。输入法也是这个意思。
第九个和3721也很有关联,就是导航站。hao123,265。大家也能想到域名买卖、虚拟主机、流量统计、SEO、推广、邮件群发、黄页、连锁加盟黄页网、阿里巴巴、做网站公司、五洲在线、6688。
第十个不能不提google邮箱,启动快速、无限量、搜索准确、邮件反复回复关联强。尤其推荐口碑营销邀请加入,够创新。
第十一个是游戏。这就不说了。征途的虚拟装备和地推和逢年过节的随机掉宝新任务、QQ的虚拟装备和Q币、盛大的计时计费和点卡渠道。高。创新的非常好。
第十二个是好耶。当然也关联着分众,以及N多各个细分行业的分众们。但好耶和分众还不太一样。分众是自己在新的地皮上开辟新疆土,而好耶不仅做互联网窄告这一创新模式,好耶还是大代理商,如同携程。
第十三个是携程。这是个好模式。携程属于票务,但和演出票还不一样没有过期作废性,而且消费群体更大。携程的地推模式、呼叫中心模式、现在在机场深度拉人模式,都值得学习。
第十四个是当当。当当、卓越、京东、红孩子、麦网等等,从网站、呼叫中心、目录邮购、仓储、配送,都在低调受苦受累的做。他们是一类。
第十五个是淘宝、阿里。太独,太份额大,所以很难找到类比。他们不进货不压货不卖货,只搭建平台。
第十六个是支付宝。没有它,电子商务的接受规模可能远远小于现在。推动中国电子商务行当做大,它功不可没。
第十七个是黄页、加盟网、阿里巴巴。这是B2B的主要模式。你对比对比,你就知道B2B该怎么走了,为什么只能这么走,这么走还有哪些缺陷,如何更小成本更容易的解决这些缺陷,你有创新性的思维吗?
第十八是视频网。过去很多年前想收藏的《义不容情》《雍正皇帝》《八月桂花香》《大长今》《商道》都能随时看了。但就是不知道怎么赚钱,而烧钱却非常快。GOOGLE收了youtube,也没辙。流量很高,但收入怎么来?
第十九个是社区、SNS、WEB2.0,也包括同学录。从这里还能引申想到社会化商务、点评、豆瓣,还能想到flash小游戏、摩尔庄园、4399等等。哦,还有盒子。
第二十个是和生活相关的。从分类信息和点评引发,最后出来爱帮、地图,也和垂直搜索、电子商务有些关联。谁还能记起分类网站?各种拼车网站?大别针换房子?
第二十一个是口碑营销引发。有个专门的人肉搜索、刷流量、刷信用、刷评论等等专业小公司。有本书叫众包。就是这个意思。这是一种新模式。我还想起威客网,大家现在谁记得?盈利模式哪里不对劲?在什么环境下可以成功?
第二十二个是移动互联网。移动QQ流量最大,然后是看新闻、看电子小说、查地图、搜索。决斗聊天、搜索、浏览器、导航、新闻、地图、生活搜索。
每一个都是独特的,每一个都是鲜活的。每一个都是创新的。下一个,是谁加谁,谁联合谁然后变种成了什么?移动+生活+地图+IM+支付+电子商务(淘宝、vancl、携程、当当)(网站、呼叫中心、短信、邮件、目录邮购、仓储、配送、地推)+社区(点评、贴吧、QQ群、微博)?还得是人气+广告、人气+卖实物东西、好玩+虚拟装备、收集数据清洗数据保鲜数据卖数据统计数据分析数据+付费,你看呢?
Tuesday, September 15, 2009
Google UFO 系列 doodle 谜底渐渐清晰——纪念 H.G.Wells
![go_gle[1] go_gle[1]](http://google.org.cn/wp-content/uploads/2009/09/go_gle1.gif)
![goog_e[1] goog_e[1]](http://google.org.cn/wp-content/uploads/2009/09/goog_e1.gif)
Google的这个外星人系列可谓是今年最具悬念的doodle了,每幅doodle都配备了一个相应的谜题,并引领你走向最终的答案。9月5日第一个doodle的谜底是"All your o are belong to us",结合图像暗示了谜底和外星人有关。而今天的麦田圈doodle的谜面也不难:51.327629, -0.5616088。
这个谜面其实是一个Google Maps坐标——指向英国萨里郡(Surrey, England)的Horsell Woking。在H.G Wells 1898年的科幻小说作品The War of the Worlds(世界大战)中,英国被来自火星的外星人入侵,而UFO降落的第一个地点就是Wells家附近的Horsell Common。
从wikipedia我们可以得知,H.G.Wells生于1866年9月21日,今天距离他143周年诞辰还有6天,我们有充足的理由相信这一系列doodle正是为了纪念他而精心设计的。
Monday, September 14, 2009
How to Fix the IE6 Select Box z-index Bug
This is my first time experienced the IE6 z-index bug where a simple select box will always take priority over any predefined z-indices and always show up on top. see the screenshot:

I did search around and luckily discovered that there is a fix -JQuery plugin which by using an iframe and expanding it over the select box area, the iframe will take precendence over the select box. This JQuery plugin will automatically create the iframe for you. The plugin is simply called bgiframe and using it is quick and easy. Just include the script and attach the bgiframe() method to all of your floating layers. Here is a short and quick example:
I did search around and luckily discovered that there is a fix -JQuery plugin which by using an iframe and expanding it over the select box area, the iframe will take precendence over the select box. This JQuery plugin will automatically create the iframe for you. The plugin is simply called bgiframe and using it is quick and easy. Just include the script and attach the bgiframe() method to all of your floating layers. Here is a short and quick example:
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.bgiframe.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#floating_div').bgiframe();
}
</script>
</head>
<body>
<select>
<option>Test</option>
</select>
<div id="floating_div">I'm over this select box</div>
</body>Now those nasty z-index bugs won’t ever trouble you ever again.



