Greensleeves 2.0 / Archive / 2007-03 / 060051
Notes about XHTML, CSS, Flash, ActionScript, Javascript and I'm Interested in...
全称セレクタを使ったスタイル初期化の問題点
CSS を書く際、ブラウザごとのデフォルトスタイルの差異を吸収するため * を使ったリセットを行う。という有名な Tip があります。
この手法は便利で今もここの CSS で使わせてもらっているんですが、しかしある問題を抱えている模様。それは CSS techniques I use all the time | The Montoya Herald で詳しく書かれています。言及部分を抜粋してみると。
This eliminated all differences in padding and margin across browsers so I was free to go about styling my page. Unfortunately, this isn’t a good practice. It’s very heavy on the rendering agent to apply rules to every single element in the document, especially with large web pages, and this can also destroy a lot of good default styling, especially when you want to have default styled submit buttons.
簡単に言ってしまえば、ページが巨大になるとレンダリング速度に影響が出てくることと、使えるデフォルトスタイルまで殺してしまうことが懸念される。ということらしいです。
氏は同時に、自分の初期化用の CSS も載せているのでそこら辺を参考にリセット用の CSS を組んでみるのもいいかもしれません。億劫な人には Yahoo! UI Library: Reset CSS とかもお勧め。
この記事に対するコメントはまだありません。