リセットCSS(reset css)とは?

HTML/CSSを制作している時に、Chrome・Safari・Firefoxなど各ブラウザで同じHTML/CSSなのに見た目が違うという事があります。
これは各ブラウザが固有にデフォルトのCSSを用意しており、その影響でブラウザ毎に見え方が異なる事が原因です。
input要素や文字サイズ、余白までブラウザ毎に異なる事があり、このブラウザ間のデフォルトのCSSの表示の差異を埋めるための方法がリセットCSS(reset css)です。
つまりリセットCSSを使うことによって、input/ul/li/p/h1/h2・・など、どのタグを利用しても見え方や余白が統一され、ブラウザ間の表示の差異が埋まるということです。
メリット

リセットCSSのメリットはブラウザ間の表示の差異が埋まる点です。逆にリセットCSSが無いと、ブラウザ毎にデバッグして、CSSを調整していく必要が出てきます。
デメリット

デメリットとしてはリセットCSSを導入することでCSSの容量が長くなり、表示速度が落ちる可能性がある点です。とはいえ、リセットCSSはそれほど長いCSSではないので気にならないという方が多いかと思います。
またもう一つデメリットをあげておくと、ブラウザのデフォルトのデザインはある程度整っていて、CSSが何も設定されていなくても見た目がある程度見栄えするものとなっています。それがリセットCSSで完全にクリアされますので、自分で何も設定しないとデザインが簡素になりがちです。
リセットCSSの種類
リセットCSSにはいくつか種類があります。オープンソースで管理されているものや、各サイトで配布されているものなどいくつかあり、それぞれでリセットCSSの書き方が異なっています。

一方で初心者の方やリセットCSSを使った事がない方からすると、いくつかあるリセットCSSのどれを使ったらいいのか迷っている方もいらっしゃるかと思います。
そこでこの記事では数あるリセットCSSからおすすめのリセットCSS7選をご紹介していきます。
リセットCSSの使い方
リセットCSSは通常のCSSと同じくheadタグの中にstyleタグを追加することで導入することが出来ます。
今回はサンプルコードを用意していますので、サンプルコードをコピペしてぜひご利用下さい。
おすすめのリセットCSS7選
それではおすすめのリセットCSS7選をご紹介していきます。下記のサンプルのHTMLを用意しましたので、それぞれのリセットCSSどうデザインが表示されるか見てみましょう。
(リセットCSSの目的である、デフォルトのブラウザのCSSをクリアする事と、ある程度のデザインを付与するNormalize.cssのようなものも今回一緒くたにご紹介しています。)
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
</head>
<body>
<section>
<h1>見出し1</h1>
<h2>見出し2</h2>
<h3>見出し3</h3>
<h4>見出し4</h4>
<h5>見出し5</h5>
<h6>見出し6</h6>
<p>段落</p>
<p>段落<br>改行して段落段落段落</p>
<p>
<a href="#">リンク</a><strong>太字</strong><em>強調</em><small>小さい文字</small>
</p>
</section>
<section>
<ul>
<li>順序なしリスト</li>
<li>順序なしリスト</li>
<li>順序なしリスト</li>
</ul>
<ol>
<li>数字リスト</li>
<li>数字リスト</li>
<li>数字リスト</li>
</ol>
<dl>
<dt>定義リストタイトル</dt>
<dd>定義リストテキスト</dd>
<dt>定義リストタイトル</dt>
<dd>定義リストテキスト</dd>
</dl>
</section>
<section>
<form>
<div><input type="text" value="テキスト"></div>
<div>
<select>
<option>選択肢</option>
</select>
</div>
<div><textarea>テキストエリア</textarea></div>
<div>
<label><input type="checkbox">チェックボックス</label>
</div>
<div>
<label><input type="radio">ラジオボタン</label>
</div>
<div><button type="button">ボタン</button></div>
</form>
</section>
<section>
<pre>整形済みテキスト </pre>
<blockquote>引用テキスト</blockquote>
</section>
<section>
<table>
<tbody>
<tr>
<th>テーブル見出し</th>
<th>テーブル見出し</th>
</tr>
<tr>
<td>セル</td>
<td>セル</td>
</tr>
<tr>
<td>セル</td>
<td>セル</td>
</tr>
</tbody>
</table>
</section>
</body>
</html>
Eric Mayer’s Reset CSS 2.0
Ecir Mayer's Reset CSS 2.0は人気で、よく利用されているリセットCSSの一つです。その容量も小さく、空白や改行を除いて1k弱のサイズでリセットCSSを利用することが出来ます。
早速利用してみましょう。
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<style>
/* 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;
}
</style>
</head>
<body>
<section>
<h1>見出し1</h1>
<h2>見出し2</h2>
<h3>見出し3</h3>
<h4>見出し4</h4>
<h5>見出し5</h5>
<h6>見出し6</h6>
<p>段落</p>
<p>段落<br>改行して段落段落段落</p>
<p>
<a href="#">リンク</a><strong>太字</strong><em>強調</em><small>小さい文字</small>
</p>
</section>
<section>
<ul>
<li>順序なしリスト</li>
<li>順序なしリスト</li>
<li>順序なしリスト</li>
</ul>
<ol>
<li>数字リスト</li>
<li>数字リスト</li>
<li>数字リスト</li>
</ol>
<dl>
<dt>定義リストタイトル</dt>
<dd>定義リストテキスト</dd>
<dt>定義リストタイトル</dt>
<dd>定義リストテキスト</dd>
</dl>
</section>
<section>
<form>
<div><input type="text" value="テキスト"></div>
<div>
<select>
<option>選択肢</option>
</select>
</div>
<div><textarea>テキストエリア</textarea></div>
<div>
<label><input type="checkbox">チェックボックス</label>
</div>
<div>
<label><input type="radio">ラジオボタン</label>
</div>
<div><button type="button">ボタン</button></div>
</form>
</section>
<section>
<pre>整形済みテキスト </pre>
<blockquote>引用テキスト</blockquote>
</section>
<section>
<table>
<tbody>
<tr>
<th>テーブル見出し</th>
<th>テーブル見出し</th>
</tr>
<tr>
<td>セル</td>
<td>セル</td>
</tr>
<tr>
<td>セル</td>
<td>セル</td>
</tr>
</tbody>
</table>
</section>
</body>
</html>/* 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;
}※リセットCSSだけコピーしたい方は上記サンプルの「reset.css」のタブをクリックしてCSSをコピペすることが出来ます。
いかがでしょうか。最初のサンプルのHTMLの結果と比べてまず余白がなくなっているのに気づきますよね。
また太字や文字サイズなどがリセットされ、統一されているのがわかるかと思います。
HTML5 Doctor CSS Reset
HTML5 Doctor CSS Resetも有名なリセットCSSです。当初Eric Mayer's Rest CSS 2.0が対応していなかったHTML5のタグに対応したリセットCSSとなります。
リセットCSSのサイズは1.5k弱となっており、Mayer's Reset CSS 2.0と比べると1.5倍ほど容量があります。
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<style>
/*
html5doctor.com Reset Stylesheet
v1.6.1
Last Updated: 2010-09-17
Author: Richard Clark - http://richclarkdesign.com
Twitter: @rich_clark
*/
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;
}
</style>
</head>
<body>
<section>
<h1>見出し1</h1>
<h2>見出し2</h2>
<h3>見出し3</h3>
<h4>見出し4</h4>
<h5>見出し5</h5>
<h6>見出し6</h6>
<p>段落</p>
<p>段落<br>改行して段落段落段落</p>
<p>
<a href="#">リンク</a><strong>太字</strong><em>強調</em><small>小さい文字</small>
</p>
</section>
<section>
<ul>
<li>順序なしリスト</li>
<li>順序なしリスト</li>
<li>順序なしリスト</li>
</ul>
<ol>
<li>数字リスト</li>
<li>数字リスト</li>
<li>数字リスト</li>
</ol>
<dl>
<dt>定義リストタイトル</dt>
<dd>定義リストテキスト</dd>
<dt>定義リストタイトル</dt>
<dd>定義リストテキスト</dd>
</dl>
</section>
<section>
<form>
<div><input type="text" value="テキスト"></div>
<div>
<select>
<option>選択肢</option>
</select>
</div>
<div><textarea>テキストエリア</textarea></div>
<div>
<label><input type="checkbox">チェックボックス</label>
</div>
<div>
<label><input type="radio">ラジオボタン</label>
</div>
<div><button type="button">ボタン</button></div>
</form>
</section>
<section>
<pre>整形済みテキスト </pre>
<blockquote>引用テキスト</blockquote>
</section>
<section>
<table>
<tbody>
<tr>
<th>テーブル見出し</th>
<th>テーブル見出し</th>
</tr>
<tr>
<td>セル</td>
<td>セル</td>
</tr>
<tr>
<td>セル</td>
<td>セル</td>
</tr>
</tbody>
</table>
</section>
</body>
</html>
/*
html5doctor.com Reset Stylesheet
v1.6.1
Last Updated: 2010-09-17
Author: Richard Clark - http://richclarkdesign.com
Twitter: @rich_clark
*/
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;
}いかがでしょうか。余白についてはMayer'sと同じく消えていますが、太字であってほしいタグで太字が残っていたり、文字サイズにも若干の違いがありますね。
Reboot.css
こちらはデザインの知識がなくても簡単におしゃれなデザインが導入できるBootstrapで使用されているリセットCSSとなります。Bootstrapを使った事がある方はある程度ご存知かもしれませんが、Bootstrapのデザインってはっきり、Bootstrapを使っているとわかりますよね(笑)
そのBootstrapのリセットCSSのため、若干その雰囲気があります。バイト数は5k超えています。
リセットCSSの枠を超えてきますが、ブラウザ間で表示の差異をなくしつつ、ある程度のデザインをしてほしいという場合に有効です。
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<style>
/*!
* Bootstrap Reboot v4.3.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
html {
font-family: sans-serif;
line-height: 1.15;
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
article, aside, figcaption, figure, footer, header, hgroup, main, nav, section {
display: block;
}
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #212529;
text-align: left;
background-color: #fff;
}
[tabindex="-1"]:focus {
outline: 0 !important;
}
hr {
box-sizing: content-box;
height: 0;
overflow: visible;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 0;
margin-bottom: 0.5rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-original-title] {
text-decoration: underline;
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
border-bottom: 0;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: .5rem;
margin-left: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 80%;
}
sub,
sup {
position: relative;
font-size: 75%;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -.25em;
}
sup {
top: -.5em;
}
a {
color: #007bff;
text-decoration: none;
background-color: transparent;
}
a:hover {
color: #0056b3;
text-decoration: underline;
}
a:not([href]):not([tabindex]) {
color: inherit;
text-decoration: none;
}
a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus {
color: inherit;
text-decoration: none;
}
a:not([href]):not([tabindex]):focus {
outline: 0;
}
pre,
code,
kbd,
samp {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em;
}
pre {
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
}
figure {
margin: 0 0 1rem;
}
img {
vertical-align: middle;
border-style: none;
}
svg {
overflow: hidden;
vertical-align: middle;
}
table {
border-collapse: collapse;
}
caption {
padding-top: 0.75rem;
padding-bottom: 0.75rem;
color: #6c757d;
text-align: left;
caption-side: bottom;
}
th {
text-align: inherit;
}
label {
display: inline-block;
margin-bottom: 0.5rem;
}
button {
border-radius: 0;
}
button:focus {
outline: 1px dotted;
outline: 5px auto -webkit-focus-ring-color;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
input {
overflow: visible;
}
button,
select {
text-transform: none;
}
select {
word-wrap: normal;
}
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
button:not(:disabled),
[type="button"]:not(:disabled),
[type="reset"]:not(:disabled),
[type="submit"]:not(:disabled) {
cursor: pointer;
}
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
padding: 0;
border-style: none;
}
input[type="radio"],
input[type="checkbox"] {
box-sizing: border-box;
padding: 0;
}
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"] {
-webkit-appearance: listbox;
}
textarea {
overflow: auto;
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
display: block;
width: 100%;
max-width: 100%;
padding: 0;
margin-bottom: .5rem;
font-size: 1.5rem;
line-height: inherit;
color: inherit;
white-space: normal;
}
progress {
vertical-align: baseline;
}
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
[type="search"] {
outline-offset: -2px;
-webkit-appearance: none;
}
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
summary {
display: list-item;
cursor: pointer;
}
template {
display: none;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.css.map */
</style>
</head>
<body>
<section>
<h1>見出し1</h1>
<h2>見出し2</h2>
<h3>見出し3</h3>
<h4>見出し4</h4>
<h5>見出し5</h5>
<h6>見出し6</h6>
<p>段落</p>
<p>段落<br>改行して段落段落段落</p>
<p>
<a href="#">リンク</a><strong>太字</strong><em>強調</em><small>小さい文字</small>
</p>
</section>
<section>
<ul>
<li>順序なしリスト</li>
<li>順序なしリスト</li>
<li>順序なしリスト</li>
</ul>
<ol>
<li>数字リスト</li>
<li>数字リスト</li>
<li>数字リスト</li>
</ol>
<dl>
<dt>定義リストタイトル</dt>
<dd>定義リストテキスト</dd>
<dt>定義リストタイトル</dt>
<dd>定義リストテキスト</dd>
</dl>
</section>
<section>
<form>
<div><input type="text" value="テキスト"></div>
<div>
<select>
<option>選択肢</option>
</select>
</div>
<div><textarea>テキストエリア</textarea></div>
<div>
<label><input type="checkbox">チェックボックス</label>
</div>
<div>
<label><input type="radio">ラジオボタン</label>
</div>
<div><button type="button">ボタン</button></div>
</form>
</section>
<section>
<pre>整形済みテキスト </pre>
<blockquote>引用テキスト</blockquote>
</section>
<section>
<table>
<tbody>
<tr>
<th>テーブル見出し</th>
<th>テーブル見出し</th>
</tr>
<tr>
<td>セル</td>
<td>セル</td>
</tr>
<tr>
<td>セル</td>
<td>セル</td>
</tr>
</tbody>
</table>
</section>
</body>
</html>/*!
* Bootstrap Reboot v4.3.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
html {
font-family: sans-serif;
line-height: 1.15;
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
article, aside, figcaption, figure, footer, header, hgroup, main, nav, section {
display: block;
}
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #212529;
text-align: left;
background-color: #fff;
}
[tabindex="-1"]:focus {
outline: 0 !important;
}
hr {
box-sizing: content-box;
height: 0;
overflow: visible;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 0;
margin-bottom: 0.5rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-original-title] {
text-decoration: underline;
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
border-bottom: 0;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: .5rem;
margin-left: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 80%;
}
sub,
sup {
position: relative;
font-size: 75%;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -.25em;
}
sup {
top: -.5em;
}
a {
color: #007bff;
text-decoration: none;
background-color: transparent;
}
a:hover {
color: #0056b3;
text-decoration: underline;
}
a:not([href]):not([tabindex]) {
color: inherit;
text-decoration: none;
}
a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus {
color: inherit;
text-decoration: none;
}
a:not([href]):not([tabindex]):focus {
outline: 0;
}
pre,
code,
kbd,
samp {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em;
}
pre {
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
}
figure {
margin: 0 0 1rem;
}
img {
vertical-align: middle;
border-style: none;
}
svg {
overflow: hidden;
vertical-align: middle;
}
table {
border-collapse: collapse;
}
caption {
padding-top: 0.75rem;
padding-bottom: 0.75rem;
color: #6c757d;
text-align: left;
caption-side: bottom;
}
th {
text-align: inherit;
}
label {
display: inline-block;
margin-bottom: 0.5rem;
}
button {
border-radius: 0;
}
button:focus {
outline: 1px dotted;
outline: 5px auto -webkit-focus-ring-color;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
input {
overflow: visible;
}
button,
select {
text-transform: none;
}
select {
word-wrap: normal;
}
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
button:not(:disabled),
[type="button"]:not(:disabled),
[type="reset"]:not(:disabled),
[type="submit"]:not(:disabled) {
cursor: pointer;
}
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
padding: 0;
border-style: none;
}
input[type="radio"],
input[type="checkbox"] {
box-sizing: border-box;
padding: 0;
}
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"] {
-webkit-appearance: listbox;
}
textarea {
overflow: auto;
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
display: block;
width: 100%;
max-width: 100%;
padding: 0;
margin-bottom: .5rem;
font-size: 1.5rem;
line-height: inherit;
color: inherit;
white-space: normal;
}
progress {
vertical-align: baseline;
}
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
[type="search"] {
outline-offset: -2px;
-webkit-appearance: none;
}
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
summary {
display: list-item;
cursor: pointer;
}
template {
display: none;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.css.map */いかがでしょうか。これまでにに比べて、タグ毎にデザインがはっきり別れています。このあたりは好みにもなりますが、自分でカスタマイズしていく中で
- すべてまっさらなデザインからスタートしたい
- ある程度デザインが出来ている状態からスタートしたい
Normalize.css
Normalize.cssもReboot.cssと同じくデフォルトのCSSを無効にしつつ、ある程度デザインを初期化して整えていくれます。
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<style>
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in iOS.
*/
html {
line-height: 1.15; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/* Sections
========================================================================== */
/**
* Remove the margin in all browsers.
*/
body {
margin: 0;
}
/**
* Render the `main` element consistently in IE.
*/
main {
display: block;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/* Grouping content
========================================================================== */
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
pre {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/* Text-level semantics
========================================================================== */
/**
* Remove the gray background on active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* 1. Remove the bottom border in Chrome 57-
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
samp {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* Embedded content
========================================================================== */
/**
* Remove the border on images inside links in IE 10.
*/
img {
border-style: none;
}
/* Forms
========================================================================== */
/**
* 1. Change the font styles in all browsers.
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
optgroup,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 1 */
line-height: 1.15; /* 1 */
margin: 0; /* 2 */
}
/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input { /* 1 */
overflow: visible;
}
/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select { /* 1 */
text-transform: none;
}
/**
* Correct the inability to style clickable types in iOS and Safari.
*/
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
/**
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
/**
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
/**
* Correct the padding in Firefox.
*/
fieldset {
padding: 0.35em 0.75em 0.625em;
}
/**
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from `fieldset` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
legend {
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
}
/**
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
vertical-align: baseline;
}
/**
* Remove the default vertical scrollbar in IE 10+.
*/
textarea {
overflow: auto;
}
/**
* 1. Add the correct box sizing in IE 10.
* 2. Remove the padding in IE 10.
*/
[type="checkbox"],
[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type="search"] {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
* Remove the inner padding in Chrome and Safari on macOS.
*/
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}
/* Interactive
========================================================================== */
/*
* Add the correct display in Edge, IE 10+, and Firefox.
*/
details {
display: block;
}
/*
* Add the correct display in all browsers.
*/
summary {
display: list-item;
}
/* Misc
========================================================================== */
/**
* Add the correct display in IE 10+.
*/
template {
display: none;
}
/**
* Add the correct display in IE 10.
*/
[hidden] {
display: none;
}
</style>
</head>
<body>
<section>
<h1>見出し1</h1>
<h2>見出し2</h2>
<h3>見出し3</h3>
<h4>見出し4</h4>
<h5>見出し5</h5>
<h6>見出し6</h6>
<p>段落</p>
<p>段落<br>改行して段落段落段落</p>
<p>
<a href="#">リンク</a><strong>太字</strong><em>強調</em><small>小さい文字</small>
</p>
</section>
<section>
<ul>
<li>順序なしリスト</li>
<li>順序なしリスト</li>
<li>順序なしリスト</li>
</ul>
<ol>
<li>数字リスト</li>
<li>数字リスト</li>
<li>数字リスト</li>
</ol>
<dl>
<dt>定義リストタイトル</dt>
<dd>定義リストテキスト</dd>
<dt>定義リストタイトル</dt>
<dd>定義リストテキスト</dd>
</dl>
</section>
<section>
<form>
<div><input type="text" value="テキスト"></div>
<div>
<select>
<option>選択肢</option>
</select>
</div>
<div><textarea>テキストエリア</textarea></div>
<div>
<label><input type="checkbox">チェックボックス</label>
</div>
<div>
<label><input type="radio">ラジオボタン</label>
</div>
<div><button type="button">ボタン</button></div>
</form>
</section>
<section>
<pre>整形済みテキスト </pre>
<blockquote>引用テキスト</blockquote>
</section>
<section>
<table>
<tbody>
<tr>
<th>テーブル見出し</th>
<th>テーブル見出し</th>
</tr>
<tr>
<td>セル</td>
<td>セル</td>
</tr>
<tr>
<td>セル</td>
<td>セル</td>
</tr>
</tbody>
</table>
</section>
</body>
</html>/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in iOS.
*/
html {
line-height: 1.15; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/* Sections
========================================================================== */
/**
* Remove the margin in all browsers.
*/
body {
margin: 0;
}
/**
* Render the `main` element consistently in IE.
*/
main {
display: block;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/* Grouping content
========================================================================== */
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box; /* 1 */
height: 0; /* 1 */
overflow: visible; /* 2 */
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
pre {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/* Text-level semantics
========================================================================== */
/**
* Remove the gray background on active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* 1. Remove the bottom border in Chrome 57-
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none; /* 1 */
text-decoration: underline; /* 2 */
text-decoration: underline dotted; /* 2 */
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
samp {
font-family: monospace, monospace; /* 1 */
font-size: 1em; /* 2 */
}
/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* Embedded content
========================================================================== */
/**
* Remove the border on images inside links in IE 10.
*/
img {
border-style: none;
}
/* Forms
========================================================================== */
/**
* 1. Change the font styles in all browsers.
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
optgroup,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 1 */
line-height: 1.15; /* 1 */
margin: 0; /* 2 */
}
/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input { /* 1 */
overflow: visible;
}
/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select { /* 1 */
text-transform: none;
}
/**
* Correct the inability to style clickable types in iOS and Safari.
*/
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
/**
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
/**
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
/**
* Correct the padding in Firefox.
*/
fieldset {
padding: 0.35em 0.75em 0.625em;
}
/**
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from `fieldset` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
legend {
box-sizing: border-box; /* 1 */
color: inherit; /* 2 */
display: table; /* 1 */
max-width: 100%; /* 1 */
padding: 0; /* 3 */
white-space: normal; /* 1 */
}
/**
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
vertical-align: baseline;
}
/**
* Remove the default vertical scrollbar in IE 10+.
*/
textarea {
overflow: auto;
}
/**
* 1. Add the correct box sizing in IE 10.
* 2. Remove the padding in IE 10.
*/
[type="checkbox"],
[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type="search"] {
-webkit-appearance: textfield; /* 1 */
outline-offset: -2px; /* 2 */
}
/**
* Remove the inner padding in Chrome and Safari on macOS.
*/
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
font: inherit; /* 2 */
}
/* Interactive
========================================================================== */
/*
* Add the correct display in Edge, IE 10+, and Firefox.
*/
details {
display: block;
}
/*
* Add the correct display in all browsers.
*/
summary {
display: list-item;
}
/* Misc
========================================================================== */
/**
* Add the correct display in IE 10+.
*/
template {
display: none;
}
/**
* Add the correct display in IE 10.
*/
[hidden] {
display: none;
}Normalize.cssのバイト数や約5kです。デザインはReboot.cssよりは癖のない、デザインとなります。
ress
ressもNormalize.cssやReboot.cssと同じくある程度のデザインをしてくれます。後のサンプルを見ていくとわかりますが、marginやpaddingをしていないので、余白の調整はカスタマイズしやすくなっています。
バイト数は約6kです。
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<style>
/*!
* ress.css • v1.2.2
* MIT License
* github.com/filipelinhares/ress
*/
/* # =================================================================
# Global selectors
# ================================================================= */
html {
box-sizing: border-box;
overflow-y: scroll; /* All browsers without overlaying scrollbars */
-webkit-text-size-adjust: 100%; /* iOS 8+ */
}
*,
::before,
::after {
background-repeat: no-repeat; /* Set `background-repeat: no-repeat` to all elements and pseudo elements */
box-sizing: inherit;
}
::before,
::after {
text-decoration: inherit; /* Inherit text-decoration and vertical align to ::before and ::after pseudo elements */
vertical-align: inherit;
}
* {
padding: 0; /* Reset `padding` and `margin` of all elements */
margin: 0;
}
/* # =================================================================
# General elements
# ================================================================= */
/* Add the correct display in iOS 4-7.*/
audio:not([controls]) {
display: none;
height: 0;
}
hr {
overflow: visible; /* Show the overflow in Edge and IE */
}
/*
* Correct `block` display not defined for any HTML5 element in IE 8/9
* Correct `block` display not defined for `details` or `summary` in IE 10/11
* and Firefox
* Correct `block` display not defined for `main` in IE 11
*/
article,
aside,
details,
figcaption,
figure,
footer,
header,
main,
menu,
nav,
section,
summary {
display: block;
}
summary {
display: list-item; /* Add the correct display in all browsers */
}
small {
font-size: 80%; /* Set font-size to 80% in `small` elements */
}
[hidden],
template {
display: none; /* Add the correct display in IE */
}
abbr[title] {
border-bottom: 1px dotted; /* Add a bordered underline effect in all browsers */
text-decoration: none; /* Remove text decoration in Firefox 40+ */
}
a {
background-color: transparent; /* Remove the gray background on active links in IE 10 */
-webkit-text-decoration-skip: objects; /* Remove gaps in links underline in iOS 8+ and Safari 8+ */
}
a:active,
a:hover {
outline-width: 0; /* Remove the outline when hovering in all browsers */
}
code,
kbd,
pre,
samp {
font-family: monospace, monospace; /* Specify the font family of code elements */
}
b,
strong {
font-weight: bolder; /* Correct style set to `bold` in Edge 12+, Safari 6.2+, and Chrome 18+ */
}
dfn {
font-style: italic; /* Address styling not present in Safari and Chrome */
}
/* Address styling not present in IE 8/9 */
mark {
background-color: #ff0;
color: #000;
}
/* https://gist.github.com/unruthless/413930 */
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* # =================================================================
# Forms
# ================================================================= */
input {
border-radius: 0;
}
/* Apply cursor pointer to button elements */
button,
[type="button"],
[type="reset"],
[type="submit"],
[role="button"] {
cursor: pointer;
}
/* Replace pointer cursor in disabled elements */
[disabled] {
cursor: default;
}
[type="number"] {
width: auto; /* Firefox 36+ */
}
[type="search"] {
-webkit-appearance: textfield; /* Safari 8+ */
}
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none; /* Safari 8 */
}
textarea {
overflow: auto; /* Internet Explorer 11+ */
resize: vertical; /* Specify textarea resizability */
}
button,
input,
optgroup,
select,
textarea {
font: inherit; /* Specify font inheritance of form elements */
}
optgroup {
font-weight: bold; /* Restore the font weight unset by the previous rule. */
}
button {
overflow: visible; /* Address `overflow` set to `hidden` in IE 8/9/10/11 */
}
/* Remove inner padding and border in Firefox 4+ */
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: 0;
padding: 0;
}
/* Replace focus style removed in the border reset above */
button:-moz-focusring,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
outline: 1px dotted ButtonText;
}
button,
html [type="button"], /* Prevent a WebKit bug where (2) destroys native `audio` and `video`controls in Android 4 */
[type="reset"],
[type="submit"] {
-webkit-appearance: button; /* Correct the inability to style clickable types in iOS */
}
button,
select {
text-transform: none; /* Firefox 40+, Internet Explorer 11- */
}
/* Remove the default button styling in all browsers */
button,
input,
select,
textarea {
background-color: transparent;
border-style: none;
color: inherit;
}
/* Style select like a standard input */
select {
-moz-appearance: none; /* Firefox 36+ */
-webkit-appearance: none; /* Chrome 41+ */
}
select::-ms-expand {
display: none; /* Internet Explorer 11+ */
}
select::-ms-value {
color: currentColor; /* Internet Explorer 11+ */
}
legend {
border: 0; /* Correct `color` not being inherited in IE 8/9/10/11 */
color: inherit; /* Correct the color inheritance from `fieldset` elements in IE */
display: table; /* Correct the text wrapping in Edge and IE */
max-width: 100%; /* Correct the text wrapping in Edge and IE */
white-space: normal; /* Correct the text wrapping in Edge and IE */
}
::-webkit-file-upload-button {
-webkit-appearance: button; /* Correct the inability to style clickable types in iOS and Safari */
font: inherit; /* Change font properties to `inherit` in Chrome and Safari */
}
[type="search"] {
-webkit-appearance: textfield; /* Correct the odd appearance in Chrome and Safari */
outline-offset: -2px; /* Correct the outline style in Safari */
}
/* # =================================================================
# Specify media element style
# ================================================================= */
img {
border-style: none; /* Remove border when inside `a` element in IE 8/9/10 */
}
/* Add the correct vertical alignment in Chrome, Firefox, and Opera */
progress {
vertical-align: baseline;
}
svg:not(:root) {
overflow: hidden; /* Internet Explorer 11- */
}
audio,
canvas,
progress,
video {
display: inline-block; /* Internet Explorer 11+, Windows Phone 8.1+ */
}
/* # =================================================================
# Accessibility
# ================================================================= */
/* Hide content from screens but not screenreaders */
@media screen {
[hidden~="screen"] {
display: inherit;
}
[hidden~="screen"]:not(:active):not(:focus):not(:target) {
position: absolute !important;
clip: rect(0 0 0 0) !important;
}
}
/* Specify the progress cursor of updating elements */
[aria-busy="true"] {
cursor: progress;
}
/* Specify the pointer cursor of trigger elements */
[aria-controls] {
cursor: pointer;
}
/* Specify the unstyled cursor of disabled, not-editable, or otherwise inoperable elements */
[aria-disabled] {
cursor: default;
}
/* # =================================================================
# Selection
# ================================================================= */
/* Specify text selection background color and omit drop shadow */
::-moz-selection {
background-color: #b3d4fc; /* Required when declaring ::selection */
color: #000;
text-shadow: none;
}
::selection {
background-color: #b3d4fc; /* Required when declaring ::selection */
color: #000;
text-shadow: none;
}
</style>
</head>
<body>
<section>
<h1>見出し1</h1>
<h2>見出し2</h2>
<h3>見出し3</h3>
<h4>見出し4</h4>
<h5>見出し5</h5>
<h6>見出し6</h6>
<p>段落</p>
<p>段落<br>改行して段落段落段落</p>
<p>
<a href="#">リンク</a><strong>太字</strong><em>強調</em><small>小さい文字</small>
</p>
</section>
<section>
<ul>
<li>順序なしリスト</li>
<li>順序なしリスト</li>
<li>順序なしリスト</li>
</ul>
<ol>
<li>数字リスト</li>
<li>数字リスト</li>
<li>数字リスト</li>
</ol>
<dl>
<dt>定義リストタイトル</dt>
<dd>定義リストテキスト</dd>
<dt>定義リストタイトル</dt>
<dd>定義リストテキスト</dd>
</dl>
</section>
<section>
<form>
<div><input type="text" value="テキスト"></div>
<div>
<select>
<option>選択肢</option>
</select>
</div>
<div><textarea>テキストエリア</textarea></div>
<div>
<label><input type="checkbox">チェックボックス</label>
</div>
<div>
<label><input type="radio">ラジオボタン</label>
</div>
<div><button type="button">ボタン</button></div>
</form>
</section>
<section>
<pre>整形済みテキスト </pre>
<blockquote>引用テキスト</blockquote>
</section>
<section>
<table>
<tbody>
<tr>
<th>テーブル見出し</th>
<th>テーブル見出し</th>
</tr>
<tr>
<td>セル</td>
<td>セル</td>
</tr>
<tr>
<td>セル</td>
<td>セル</td>
</tr>
</tbody>
</table>
</section>
</body>
</html>/*!
* ress.css • v1.2.2
* MIT License
* github.com/filipelinhares/ress
*/
/* # =================================================================
# Global selectors
# ================================================================= */
html {
box-sizing: border-box;
overflow-y: scroll; /* All browsers without overlaying scrollbars */
-webkit-text-size-adjust: 100%; /* iOS 8+ */
}
*,
::before,
::after {
background-repeat: no-repeat; /* Set `background-repeat: no-repeat` to all elements and pseudo elements */
box-sizing: inherit;
}
::before,
::after {
text-decoration: inherit; /* Inherit text-decoration and vertical align to ::before and ::after pseudo elements */
vertical-align: inherit;
}
* {
padding: 0; /* Reset `padding` and `margin` of all elements */
margin: 0;
}
/* # =================================================================
# General elements
# ================================================================= */
/* Add the correct display in iOS 4-7.*/
audio:not([controls]) {
display: none;
height: 0;
}
hr {
overflow: visible; /* Show the overflow in Edge and IE */
}
/*
* Correct `block` display not defined for any HTML5 element in IE 8/9
* Correct `block` display not defined for `details` or `summary` in IE 10/11
* and Firefox
* Correct `block` display not defined for `main` in IE 11
*/
article,
aside,
details,
figcaption,
figure,
footer,
header,
main,
menu,
nav,
section,
summary {
display: block;
}
summary {
display: list-item; /* Add the correct display in all browsers */
}
small {
font-size: 80%; /* Set font-size to 80% in `small` elements */
}
[hidden],
template {
display: none; /* Add the correct display in IE */
}
abbr[title] {
border-bottom: 1px dotted; /* Add a bordered underline effect in all browsers */
text-decoration: none; /* Remove text decoration in Firefox 40+ */
}
a {
background-color: transparent; /* Remove the gray background on active links in IE 10 */
-webkit-text-decoration-skip: objects; /* Remove gaps in links underline in iOS 8+ and Safari 8+ */
}
a:active,
a:hover {
outline-width: 0; /* Remove the outline when hovering in all browsers */
}
code,
kbd,
pre,
samp {
font-family: monospace, monospace; /* Specify the font family of code elements */
}
b,
strong {
font-weight: bolder; /* Correct style set to `bold` in Edge 12+, Safari 6.2+, and Chrome 18+ */
}
dfn {
font-style: italic; /* Address styling not present in Safari and Chrome */
}
/* Address styling not present in IE 8/9 */
mark {
background-color: #ff0;
color: #000;
}
/* https://gist.github.com/unruthless/413930 */
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* # =================================================================
# Forms
# ================================================================= */
input {
border-radius: 0;
}
/* Apply cursor pointer to button elements */
button,
[type="button"],
[type="reset"],
[type="submit"],
[role="button"] {
cursor: pointer;
}
/* Replace pointer cursor in disabled elements */
[disabled] {
cursor: default;
}
[type="number"] {
width: auto; /* Firefox 36+ */
}
[type="search"] {
-webkit-appearance: textfield; /* Safari 8+ */
}
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none; /* Safari 8 */
}
textarea {
overflow: auto; /* Internet Explorer 11+ */
resize: vertical; /* Specify textarea resizability */
}
button,
input,
optgroup,
select,
textarea {
font: inherit; /* Specify font inheritance of form elements */
}
optgroup {
font-weight: bold; /* Restore the font weight unset by the previous rule. */
}
button {
overflow: visible; /* Address `overflow` set to `hidden` in IE 8/9/10/11 */
}
/* Remove inner padding and border in Firefox 4+ */
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: 0;
padding: 0;
}
/* Replace focus style removed in the border reset above */
button:-moz-focusring,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
outline: 1px dotted ButtonText;
}
button,
html [type="button"], /* Prevent a WebKit bug where (2) destroys native `audio` and `video`controls in Android 4 */
[type="reset"],
[type="submit"] {
-webkit-appearance: button; /* Correct the inability to style clickable types in iOS */
}
button,
select {
text-transform: none; /* Firefox 40+, Internet Explorer 11- */
}
/* Remove the default button styling in all browsers */
button,
input,
select,
textarea {
background-color: transparent;
border-style: none;
color: inherit;
}
/* Style select like a standard input */
select {
-moz-appearance: none; /* Firefox 36+ */
-webkit-appearance: none; /* Chrome 41+ */
}
select::-ms-expand {
display: none; /* Internet Explorer 11+ */
}
select::-ms-value {
color: currentColor; /* Internet Explorer 11+ */
}
legend {
border: 0; /* Correct `color` not being inherited in IE 8/9/10/11 */
color: inherit; /* Correct the color inheritance from `fieldset` elements in IE */
display: table; /* Correct the text wrapping in Edge and IE */
max-width: 100%; /* Correct the text wrapping in Edge and IE */
white-space: normal; /* Correct the text wrapping in Edge and IE */
}
::-webkit-file-upload-button {
-webkit-appearance: button; /* Correct the inability to style clickable types in iOS and Safari */
font: inherit; /* Change font properties to `inherit` in Chrome and Safari */
}
[type="search"] {
-webkit-appearance: textfield; /* Correct the odd appearance in Chrome and Safari */
outline-offset: -2px; /* Correct the outline style in Safari */
}
/* # =================================================================
# Specify media element style
# ================================================================= */
img {
border-style: none; /* Remove border when inside `a` element in IE 8/9/10 */
}
/* Add the correct vertical alignment in Chrome, Firefox, and Opera */
progress {
vertical-align: baseline;
}
svg:not(:root) {
overflow: hidden; /* Internet Explorer 11- */
}
audio,
canvas,
progress,
video {
display: inline-block; /* Internet Explorer 11+, Windows Phone 8.1+ */
}
/* # =================================================================
# Accessibility
# ================================================================= */
/* Hide content from screens but not screenreaders */
@media screen {
[hidden~="screen"] {
display: inherit;
}
[hidden~="screen"]:not(:active):not(:focus):not(:target) {
position: absolute !important;
clip: rect(0 0 0 0) !important;
}
}
/* Specify the progress cursor of updating elements */
[aria-busy="true"] {
cursor: progress;
}
/* Specify the pointer cursor of trigger elements */
[aria-controls] {
cursor: pointer;
}
/* Specify the unstyled cursor of disabled, not-editable, or otherwise inoperable elements */
[aria-disabled] {
cursor: default;
}
/* # =================================================================
# Selection
# ================================================================= */
/* Specify text selection background color and omit drop shadow */
::-moz-selection {
background-color: #b3d4fc; /* Required when declaring ::selection */
color: #000;
text-shadow: none;
}
::selection {
background-color: #b3d4fc; /* Required when declaring ::selection */
color: #000;
text-shadow: none;
}Yahoo! (YUI 3) Reset CSS
Yahooから提供されているリセットCSSです。バイト数は約1kと軽量となっています。
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<style>
/*
YUI 3.18.1 (build f7e7bcb)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
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}ol,ul{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;*font-size:100%}legend{color:#000}#yui3-css-stamp.cssreset{display:none}
</style>
</head>
<body>
<section>
<h1>見出し1</h1>
<h2>見出し2</h2>
<h3>見出し3</h3>
<h4>見出し4</h4>
<h5>見出し5</h5>
<h6>見出し6</h6>
<p>段落</p>
<p>段落<br>改行して段落段落段落</p>
<p>
<a href="#">リンク</a><strong>太字</strong><em>強調</em><small>小さい文字</small>
</p>
</section>
<section>
<ul>
<li>順序なしリスト</li>
<li>順序なしリスト</li>
<li>順序なしリスト</li>
</ul>
<ol>
<li>数字リスト</li>
<li>数字リスト</li>
<li>数字リスト</li>
</ol>
<dl>
<dt>定義リストタイトル</dt>
<dd>定義リストテキスト</dd>
<dt>定義リストタイトル</dt>
<dd>定義リストテキスト</dd>
</dl>
</section>
<section>
<form>
<div><input type="text" value="テキスト"></div>
<div>
<select>
<option>選択肢</option>
</select>
</div>
<div><textarea>テキストエリア</textarea></div>
<div>
<label><input type="checkbox">チェックボックス</label>
</div>
<div>
<label><input type="radio">ラジオボタン</label>
</div>
<div><button type="button">ボタン</button></div>
</form>
</section>
<section>
<pre>整形済みテキスト </pre>
<blockquote>引用テキスト</blockquote>
</section>
<section>
<table>
<tbody>
<tr>
<th>テーブル見出し</th>
<th>テーブル見出し</th>
</tr>
<tr>
<td>セル</td>
<td>セル</td>
</tr>
<tr>
<td>セル</td>
<td>セル</td>
</tr>
</tbody>
</table>
</section>
</body>
</html>/*
YUI 3.18.1 (build f7e7bcb)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
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}ol,ul{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;*font-size:100%}legend{color:#000}#yui3-css-stamp.cssreset{display:none}リセットCSSとしては申し分ない内容になっています。Yahoo社からということもあり、信頼性は高そうですね。
Shitaji.css
Shitaji.cssはWeb制作用の下地として用意されているリセットCSSです。CDNが用意されていて、1行のコピペで試すことが出来ます。
<link rel="stylesheet" src="https://cdn.jsdelivr.net/npm/shitajicss@5.0.0/docs/css/shitaji.css">
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<style>
/*! Shitaji.CSS v5.0.0 CC0-1.0 by Qrac */
*,
::before,
::after {
margin: 0;
background-repeat: no-repeat;
box-sizing: border-box;
font-size: 1em;
font-family: inherit;
font-weight: inherit;
}
::before,
::after {
vertical-align: inherit;
text-decoration: inherit;
}
html {
font-family: sans-serif;
word-break: break-word;
overflow-y: scroll;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: transparent;
}
body {
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
header,
footer,
main,
section,
article,
aside,
nav,
details,
menu,
figure,
figcaption {
display: block;
}
a {
background-color: transparent;
color: inherit;
text-decoration: none;
-webkit-text-decoration-skip: objects;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 80%;
}
ol,
ul {
padding: 0;
list-style: none;
}
abbr[title] {
text-decoration: underline;
text-decoration: underline dotted;
}
sub,
sup {
position: relative;
vertical-align: baseline;
font-size: 75%;
line-height: 0;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
pre,
code,
kbd,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
canvas,
audio,
video {
display: inline-block;
}
img,
svg,
iframe,
canvas,
audio,
video {
vertical-align: middle;
}
img {
border-style: none;
}
svg:not([fill]) {
fill: currentColor;
}
svg:not(:root) {
overflow: hidden;
}
audio:not([controls]) {
display: none;
height: 0;
}
input {
border-radius: 0;
}
button,
input {
overflow: visible;
}
button,
select {
text-transform: none;
}
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
[type="checkbox"],
[type="radio"] {
padding: 0;
}
[type="search"] {
-webkit-appearance: textfield;
outline-offset: -2px;
}
::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
height: auto;
}
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-file-upload-button {
-webkit-appearance: button;
font: inherit;
}
::-moz-focus-inner {
border-style: none;
padding: 0;
}
:-moz-focusring {
outline: 1px dotted ButtonText;
}
address {
font-style: normal;
}
textarea {
overflow: auto;
resize: vertical;
}
legend {
display: table;
max-width: 100%;
padding: 0;
color: inherit;
white-space: normal;
}
progress {
display: inline-block;
vertical-align: baseline;
}
summary {
display: list-item;
}
table {
border-collapse: collapse;
}
hr {
height: 0;
overflow: visible;
}
template {
display: none;
}
a,
area,
button,
input,
label,
select,
textarea,
[tabindex] {
-ms-touch-action: manipulation;
touch-action: manipulation;
}
::-moz-selection {
background-color: #b3d4fc;
color: #000;
text-shadow: none;
}
::selection {
background-color: #b3d4fc;
color: #000;
text-shadow: none;
}
[hidden] {
display: none;
}
[aria-busy="true"] {
cursor: progress;
}
[aria-controls] {
cursor: pointer;
}
[aria-disabled="true"],
[disabled] {
cursor: not-allowed;
}
[aria-hidden="false"][hidden]:not(:focus) {
clip: rect(0, 0, 0, 0);
display: inherit;
position: absolute;
}
</style>
</head>
<body>
<section>
<h1>見出し1</h1>
<h2>見出し2</h2>
<h3>見出し3</h3>
<h4>見出し4</h4>
<h5>見出し5</h5>
<h6>見出し6</h6>
<p>段落</p>
<p>段落<br>改行して段落段落段落</p>
<p>
<a href="#">リンク</a><strong>太字</strong><em>強調</em><small>小さい文字</small>
</p>
</section>
<section>
<ul>
<li>順序なしリスト</li>
<li>順序なしリスト</li>
<li>順序なしリスト</li>
</ul>
<ol>
<li>数字リスト</li>
<li>数字リスト</li>
<li>数字リスト</li>
</ol>
<dl>
<dt>定義リストタイトル</dt>
<dd>定義リストテキスト</dd>
<dt>定義リストタイトル</dt>
<dd>定義リストテキスト</dd>
</dl>
</section>
<section>
<form>
<div><input type="text" value="テキスト"></div>
<div>
<select>
<option>選択肢</option>
</select>
</div>
<div><textarea>テキストエリア</textarea></div>
<div>
<label><input type="checkbox">チェックボックス</label>
</div>
<div>
<label><input type="radio">ラジオボタン</label>
</div>
<div><button type="button">ボタン</button></div>
</form>
</section>
<section>
<pre>整形済みテキスト </pre>
<blockquote>引用テキスト</blockquote>
</section>
<section>
<table>
<tbody>
<tr>
<th>テーブル見出し</th>
<th>テーブル見出し</th>
</tr>
<tr>
<td>セル</td>
<td>セル</td>
</tr>
<tr>
<td>セル</td>
<td>セル</td>
</tr>
</tbody>
</table>
</section>
</body>
</html>
/*! Shitaji.CSS v5.0.0 CC0-1.0 by Qrac */
*,
::before,
::after {
margin: 0;
background-repeat: no-repeat;
box-sizing: border-box;
font-size: 1em;
font-family: inherit;
font-weight: inherit;
}
::before,
::after {
vertical-align: inherit;
text-decoration: inherit;
}
html {
font-family: sans-serif;
word-break: break-word;
overflow-y: scroll;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: transparent;
}
body {
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
header,
footer,
main,
section,
article,
aside,
nav,
details,
menu,
figure,
figcaption {
display: block;
}
a {
background-color: transparent;
color: inherit;
text-decoration: none;
-webkit-text-decoration-skip: objects;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 80%;
}
ol,
ul {
padding: 0;
list-style: none;
}
abbr[title] {
text-decoration: underline;
text-decoration: underline dotted;
}
sub,
sup {
position: relative;
vertical-align: baseline;
font-size: 75%;
line-height: 0;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
pre,
code,
kbd,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
canvas,
audio,
video {
display: inline-block;
}
img,
svg,
iframe,
canvas,
audio,
video {
vertical-align: middle;
}
img {
border-style: none;
}
svg:not([fill]) {
fill: currentColor;
}
svg:not(:root) {
overflow: hidden;
}
audio:not([controls]) {
display: none;
height: 0;
}
input {
border-radius: 0;
}
button,
input {
overflow: visible;
}
button,
select {
text-transform: none;
}
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
[type="checkbox"],
[type="radio"] {
padding: 0;
}
[type="search"] {
-webkit-appearance: textfield;
outline-offset: -2px;
}
::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
height: auto;
}
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-file-upload-button {
-webkit-appearance: button;
font: inherit;
}
::-moz-focus-inner {
border-style: none;
padding: 0;
}
:-moz-focusring {
outline: 1px dotted ButtonText;
}
address {
font-style: normal;
}
textarea {
overflow: auto;
resize: vertical;
}
legend {
display: table;
max-width: 100%;
padding: 0;
color: inherit;
white-space: normal;
}
progress {
display: inline-block;
vertical-align: baseline;
}
summary {
display: list-item;
}
table {
border-collapse: collapse;
}
hr {
height: 0;
overflow: visible;
}
template {
display: none;
}
a,
area,
button,
input,
label,
select,
textarea,
[tabindex] {
-ms-touch-action: manipulation;
touch-action: manipulation;
}
::-moz-selection {
background-color: #b3d4fc;
color: #000;
text-shadow: none;
}
::selection {
background-color: #b3d4fc;
color: #000;
text-shadow: none;
}
[hidden] {
display: none;
}
[aria-busy="true"] {
cursor: progress;
}
[aria-controls] {
cursor: pointer;
}
[aria-disabled="true"],
[disabled] {
cursor: not-allowed;
}
[aria-hidden="false"][hidden]:not(:focus) {
clip: rect(0, 0, 0, 0);
display: inherit;
position: absolute;
}こちらは下地ということもあり、ある程度整った形でCSSが組まれています。CDNやnpmでも配布されていますので、コピペではなく、npm管理のプロジェクトにもおすすめです。
バイト数は約2.5kです。
まとめ
いかがでしたでしょうか。
リセットCSSの役割や、おすすめの7選をご紹介しました。本来の目的であるブラウザ間の表示を埋めることや、タグのデフォルトのCSSをクリアするのを満たしたリセットCSSや更に一歩踏み込んである程度デザインをしてくれるものまであります。
ぜひ自身のニーズにあわせて最適なリセットCSSを選択しましょう!