No CSS Reset
来源:互联网 发布:sql一个汉字几个字符 编辑:程序博客网 时间:2024/04/30 02:22
在自己所做过的项目中还没有使用过颇为流传的 CSS Reset,就发现了下面这篇文章。
其实有时候不需要去技术跟风,只需了解一下便可。那些东西有一定的道理,但不一定适合。就像 CSS Sprite,用的有感觉了,就知道什么地方该用,什么地方不该用。如果每处都用,那就成了滥用了。
个人在平常项目中用到的最多的也就是下面这个
* {
margin: 0px;
padding: 0px;
}
觉得没有必要用 CSS Reset,个人感觉有点画蛇添足了。
IE 6 没特殊要求,基本上是放弃了。因此几个像素的大小并无太大影响,用户毕竟不可能开着2个以上浏览器同时查看一个页面吧。只要看上去精致,该对齐的能对齐了就 OK 了。
When asked recently about using a CSS reset stylesheet, I readily admitted that I don't use them. I don't use them for my blog or for any project that I work on. Admitting such can raise an eyebrow or two. Reset stylesheets are definitely becoming commonplace — as you'd expect with companies like Yahoo and industry leaders like Eric Meyer actively using them.
So, why haven't I jumped on board?
What is a CSS Reset?
In case you've never heard of such a thing, a CSS Reset is designed to set a number of element styles to a specific baseline that creates consistency across various browsers.
In the beginning
When the idea of a reset style was first introduced, it was very basic. It reset the margin and padding for all elements. The problem with that was it caused havoc with elements that didn't want their margins or padding reset (namely, form elements).
* { margin:0; padding:0; }
From there, people worked on adding to and fine-tuning the reset stylesheet to be more flexible and to reset more styles. The Meyer reset is probably the finest culmination of this effort.
Eric Meyer's Reset
Eric Meyer's reset took the concept of resetting margin and padding and took it to a whole new level, stripping styles from a number of elements, forcing you to think about what you wanted and add them back in. List items would no longer have bullets, headings would no longer be bolded, and most elements would be stripped of their margin and padding, along with some other changes.
Working with Nothing
The problem I've had with these resets is that I then find myself declaring much more than I ever needed to just to get browsers back to rendering things the way I want. As it turns out, I'm perfectly happy with how a number of elements render by default. I like lists to have bullets and strong elements to have bolded text.
And I'm okay if the various browsers show things slightly differently.
I'm okay if one browser displays an H1 a few pixels larger or smaller than other browsers. If one browser defaults to circle bullets and another to squares, that's usually not a problem. If it is, then I create a style that addresses that specific issue. I don't reset it back to zero and then set it again to what I really want.
One of the principles I took away from the Web Standards community was the concept that pixel perfect precision across the various rendering engines was impractical and a remnant of the table-based layouts of yesteryear. With CSS and progressive enhancement, it was okay that things might look a little different from one browser to the next because of variations in what they supported.
Building up
With that said, the idea of developing a base CSS file that defines some common styles that I often want from project to project — like turning off margin and padding for form elements — is a good idea.
We're seeing various CSS frameworks crop up such as Blueprint, YUI and 960.gs. Each breaking the system down only to build it back up again. Each starts with a reset, then adds on typography and a grid system.
Each of those still seem like more than I need, even though none are that large in size. Blueprint is the heaviest at around 13KB uncompressed but also includes lots of extras like styles for error messages and a print stylesheet.
Less is more
One of these days I'll put together my own base CSS or maybe I won't. To date, I haven't felt myself being overly repetitive in the styles that I set; and I haven't thought to myself, "oh, the hours I'd save myself if only I had a reset stylesheet."
So, while I have nothing against CSS reset stylesheets, I simply don't use them personally and I think that's okay.
- No CSS Reset
- Reset Css
- CSS-Reset
- CSS RESET
- reset.css
- reset.css
- CSS Reset
- CSS RESET
- CSS RESET
- reset.css
- CSS Reset
- css reset
- css reset
- css reset
- CSS reset
- reset.css
- Css Reset
- CSS Reset
- BEC商务英语词汇宝典(b part)
- Visual C# 2010从入门到精通
- (2010-09-08)Oracle数据一致性之事务隔离级别
- Mysql 执行Sql 文件
- vc6.0中文绿色增强版
- No CSS Reset
- 网上收集的爆笑笑话 汗一个
- 如何在Linux下创建与解压zip, tar, tar.gz和tar.bz2文件
- .net 实现鼠标滑动截取picturebox相关区域高宽图片
- inode节点中的三个时间总结:
- Select the Traditional Ceremony Attire around the Massive Day
- 在 Excel 文件中插入图片
- 关于NetBIOS和WinSock的(读书笔记)
- Web站点数据库分布存储浅谈