LoginSignup
1
4

More than 3 years have passed since last update.

最低限のリセットCSS

Last updated at Posted at 2020-06-23

リセット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;
}
1
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
4