リセットCSSには、
- Eric Meyer’s “Reset CSS” 2.0
- HTML5 Doctor Reset CSS
- Yahoo! (YUI 3) Reset CSS
- Normalize.css
- Reboot.css
- ress
などいくつか既存のものがありますが、最低限リセットかけたい時は下記を使っています。
@charset "UTF-8";
html,
body,
h1,
h2,
p,
ul,
li {
margin: 0;
padding: 0;
line-height: 1.0;
}
ul {
list-style: none;
}
a {
text-decoration: none;
color: inherit;
}
img {
border: none;
vertical-align: bottom;
max-width: 100%;
}
html {
font-size: 62.5%;
}
body {
background: #fff;
color: #333;
font-size: 1.6rem;
font-family:"游ゴシック",YuGothic,"Hiragino Kaku Gothic ProN",Meiryo, sans-serif;
}
色やフォントサイズは例です。
margin,padding,line-height
の余白リセットは、使用する要素にのみ当てています。デザインによって使用する要素が増えたら適時追加します。
html,
body,
h1,
h2,
h3,
h4,
p,
ul,
li,
dl,
dt,
dd {
margin: 0;
padding: 0;
line-height: 1.0;
}
table使用時
table {
border-collapse: collapse;
border-spacing: 0;
}
button・input・textarea使用時
input,
button,
select,
textarea {
appearance: none;
background: transparent;
border: none;
border-radius: 0;
font: inherit;
outline: none;
}
textarea {
resize: vertical;
}