paulund.co.uk でCSSリセットについての記事「Collection Of CSS Resets」が公開されていたので紹介します。
Eric Meyer’s “Reset CSS” 2.0
Eric Mayer氏が考案したリセットCSS。プロジェクトに合わせて編集、調整することが推奨されています。
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
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;
}
The HTML5 CSS Reset
Richard Clark氏が、Eric Mayer氏のリセットCSSをHTML5に合わせて調整したリセットCSS。
html5doctor.com Reset Stylesheet v1.6.1
Last Updated: 2010-09-17
Author: Richard Clark - http://richclarkdesign.com
*/
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figcaption, figure,
footer, header, hgroup, menu, nav, section, summary,
time, mark, audio, video {
margin:0;
padding:0;
border:0;
outline:0;
font-size:100%;
vertical-align:baseline;
background:transparent;
}
body {
line-height:1;
}
article,aside,details,figcaption,figure,
footer,header,hgroup,menu,nav,section {
display:block;
}
nav ul {
list-style:none;
}
blockquote, q {
quotes:none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content:'';
content:none;
}
a {
margin:0;
padding:0;
font-size:100%;
vertical-align:baseline;
background:transparent;
}
/* change colours to suit your needs */
ins {
background-color:#ff9;
color:#000;
text-decoration:none;
}
/* change colours to suit your needs */
mark {
background-color:#ff9;
color:#000;
font-style:italic;
font-weight:bold;
}
del {
text-decoration: line-through;
}
abbr[title], dfn[title] {
border-bottom:1px dotted;
cursor:help;
}
table {
border-collapse:collapse;
border-spacing:0;
}
/* change border colour to suit your needs */
hr {
display:block;
height:1px;
border:0;
border-top:1px solid #cccccc;
margin:1em 0;
padding:0;
}
input, select {
vertical-align:middle;
}
Yahoo! CSS Reset (YUI 3)
Yahoo! Developer NetworkのリセットCSS。
/* Yahoo! CSS Reset (YUI 3) version: 3.2.0 */ html{ color:#000; background:#FFF; } body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, textarea, p, blockquote, th, td { margin:0; padding:0; } table { border-collapse:collapse; border-spacing:0; } fieldset, img { border:0; } address, caption, cite, code, dfn, em, strong, th, var { font-style:normal; font-weight:normal; } li { list-style:none; } caption, th { text-align:left; } h1, h2, h3, h4, h5, h6 { font-size:100%; font-weight:normal; } q:before, q:after { content:''; } abbr, acronym { border:0; font-variant:normal; } sup { vertical-align:text-top; } sub { vertical-align:text-bottom; } input, textarea, select { font-family:inherit; font-size:inherit; font-weight:inherit; } input, textarea, select { *font-size:100%; } legend { color:#000; }
Vanilla CSS Un-Reset
Joen Asmussen氏の「非」リセットCSS。他のリセットCSSでスタイルをリセットした後のスタイリングに利用されることを想定されているようです。
/**
* Start Vanilla CSS 1.0.2
*/
body {
font: 9pt/1.5em sans-serif;
}
pre, code, tt {
font: 1em/1.5em 'Andale Mono', 'Lucida Console', monospace;
}
h1, h2, h3, h4, h5, h6, b, strong {
font-weight: bold;
}
em, i, dfn {
font-style: italic;
}
dfn {
font-weight:bold;
}
p, code, pre, kbd {
margin:0 0 1.5em 0;
}
blockquote {
margin:0 1.5em 1.5em 1.5em;
}
cite {
font-style: italic;
}
li ul, li ol {
margin:0 1.5em;
}
ul, ol {
margin:0 1.5em 1.5em 1.5em;
}
ul {
list-style-type:disc;
}
ol {
list-style-type:decimal;
}
ol ol {
list-style: upper-alpha;
}
ol ol ol {
list-style: lower-roman;
}
ol ol ol ol {
list-style: lower-alpha;
}
dl {
margin:0 0 1.5em 0;
}
dl dt {
font-weight:bold;
}
dd {
margin-left:1.5em;
}
table {
margin-bottom:1.4em;
width:100%;
}
th {
font-weight:bold;
}
th, td, caption {
padding:4px 10px 4px 5px;
}
tfoot {
font-style:italic;
}
sup, sub {
line-height:0;
}
abbr, acronym {
border-bottom: 1px dotted;
}
address {
margin:0 0 1.5em;
font-style:italic;
}
del {
text-decoration: line-through;
}
pre {
margin:1.5em 0;
white-space:pre;
}
img.centered, .aligncenter, div.aligncenter {
display: block;
margin-left: auto;
margin-right: auto;
}
img.alignright {
display: inline;
}
img.alignleft {
display: inline;
}
.alignright {
float: right;
margin-left: 10px;
}
.alignleft {
float: left;
margin-right: 10px;
}
img {
max-width: 100%;
}
* html .clearfix {
height: 1%;
}
* + html .clearfix {
display: inline-block;
}
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
* html .group {
height: 1%;
}
* + html .group {
display: inline-block;
}
.group:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
/**
* End Vanilla CSS
*/
reset.cssとnormalize.css
最近興味深いまとめを見つけたのでこちらもご紹介。
僕も全部ゼロゼロでリセットしちゃうのは好きでは無いので、デフォルトのスタイルを残しつつスタイルを統一するようなオリジナルのCSSを作って利用しています。既存のリセットCSSを案件や自分の使いやすさに合わせてオリジナルのものを用意しておくと制作が捗るかもしれませんね。
