「CSSのリセット」の編集履歴(バックアップ)一覧はこちら
「CSSのリセット」(2015/05/11 (月) 20:30:22) の最新版変更点
追加された行は緑色になります。
削除された行は赤色になります。
IE、Firefox、GoogleChrome、Opera、Safariなどさまざまなブラウザが存在します。しかし、各ブラウザで初期段階で持っているCSSがあり、ブラウザの表示を悩ませてくれます。このようにならないためにも、多くのWebサイトはreset.cssというシートを作り、初期化しています。今回はこの初期化についてまとめていきます。
#contents
**html5doctorのreset.css
有名なところとして、Richard Clark氏のCSSがあります。このCSSを自分の読み込みたいCSS以前に読み込ませます。~
&color(red){※以降に読み込ませてはいけません。自分の定義したCSSのほとんどがリセットされます(笑)}
解説ページ:http://www.html5-memo.com/first-html5/html5-002/
~
~
ファイル名 reset.css
/*
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;
}
**その他のCSSリセット
2014年のCSSリセット。スマートフォン等にも対応できるようになっている。
下のほうは適宜書き換えてください。
参照元:http://h-proton.com/?p=1726
@charset "utf-8";
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-style:normal;
font-weight: normal;
font-size: 100%;
vertical-align: baseline;
}
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
html{
overflow-y: scroll;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
input, textarea,{
margin: 0;
padding: 0;
}
ol, ul{
list-style:none;
}
table{
border-collapse: collapse;
border-spacing:0;
}
caption, th{
text-align: left;
}
a:focus {
outline:none;
}
.clearfix:after {
content: ".";
display: block;
clear: both;
height: 0;
visibility: hidden;
}
.clearfix {
min-height: 1px;
}
* html .clearfix {
height: 1px;
/*¥*//*/
height: auto;
overflow: hidden;
/**/
}
.both{
clear:both;
}
.inline_block {
display: inline-block;
*display: inline;
*zoom: 1;
}
/* よく使うCSS start
img {
max-width:100%;
}
table {
width:100%;
}
a,a:hover {
-webkit-transition: 0.7s;
-moz-transition: 0.7s;
-o-transition: 0.7s;
transition: 0.7s;
}
a img:hover {
filter: alpha(opacity=75);
-moz-opacity:0.75;
opacity:0.75;
}
よく使うCSS end -----
時々使うCSS3 start ---
テキストシャドウ {
text-shadow: 1px 1px 3px #000;
}
テキストシャドウ {
text-shadow: 1px 1px 3px #000;
}
ボックスシャドウ {
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;
}
ボックスシャドウ内側 {
-moz-box-shadow: inset 1px 1px 3px #000;
-webkit-box-shadow: inset 1px 1px 3px #000;
box-shadow: inset 1px 1px 3px #000;
}
角丸 {
border-radius: 8px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
}
トランジション {
-webkit-transition: 1.5s;
-moz-transition: 1.5s;
-o-transition: 1.5s;
transition: 1.5s;
}
透明 {
filter: alpha(opacity=25);
-moz-opacity:0.25;
opacity:0.25;
}
背景のみ透明 {
background-color:rgba(255,255,255,0.2);
}
グラデーション {
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#ffffff', endColorstr = '#000000');
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr = '#ffffff', endColorstr = '#000000')";
background-image: -moz-linear-gradient(top, #ffffff, #000000);
background-image: -ms-linear-gradient(top, #ffffff, #000000);
background-image: -o-linear-gradient(top, #ffffff, #000000);
background-image: -webkit-gradient(linear, center top, center bottom, from(#ffffff), to(#000000));
background-image: -webkit-linear-gradient(top, #ffffff, #000000);
background-image: linear-gradient(top, #ffffff, #000000);
}
スマホ対応
@media screen and (max-width: 480px){
}
@media screen and (max-width: 320px){
}
時々使うCSS3 end */
IE、Firefox、GoogleChrome、Opera、Safariなどさまざまなブラウザが存在します。しかし、各ブラウザで初期段階で持っているCSSがあり、ブラウザの表示を悩ませてくれます。このようにならないためにも、多くのWebサイトはreset.cssというシートを作り、初期化しています。今回はこの初期化についてまとめていきます。
#contents
**html5doctorのreset.css
有名なところとして、Richard Clark氏のCSSがあります。このCSSを自分の読み込みたいCSS以前に読み込ませます。~
&color(red){※以降に読み込ませてはいけません。自分の定義したCSSのほとんどがリセットされます(笑)}
解説ページ:http://www.html5-memo.com/first-html5/html5-002/
~
Richard氏の解説ページ:http://html5doctor.com/html-5-reset-stylesheet/
~
ファイル名 reset.css
/*
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;
}
**その他のCSSリセット
2014年のCSSリセット。スマートフォン等にも対応できるようになっている。
下のほうは適宜書き換えてください。
参照元:http://h-proton.com/?p=1726
@charset "utf-8";
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-style:normal;
font-weight: normal;
font-size: 100%;
vertical-align: baseline;
}
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
html{
overflow-y: scroll;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
input, textarea,{
margin: 0;
padding: 0;
}
ol, ul{
list-style:none;
}
table{
border-collapse: collapse;
border-spacing:0;
}
caption, th{
text-align: left;
}
a:focus {
outline:none;
}
.clearfix:after {
content: ".";
display: block;
clear: both;
height: 0;
visibility: hidden;
}
.clearfix {
min-height: 1px;
}
* html .clearfix {
height: 1px;
/*¥*//*/
height: auto;
overflow: hidden;
/**/
}
.both{
clear:both;
}
.inline_block {
display: inline-block;
*display: inline;
*zoom: 1;
}
/* よく使うCSS start
img {
max-width:100%;
}
table {
width:100%;
}
a,a:hover {
-webkit-transition: 0.7s;
-moz-transition: 0.7s;
-o-transition: 0.7s;
transition: 0.7s;
}
a img:hover {
filter: alpha(opacity=75);
-moz-opacity:0.75;
opacity:0.75;
}
よく使うCSS end -----
時々使うCSS3 start ---
テキストシャドウ {
text-shadow: 1px 1px 3px #000;
}
テキストシャドウ {
text-shadow: 1px 1px 3px #000;
}
ボックスシャドウ {
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;
}
ボックスシャドウ内側 {
-moz-box-shadow: inset 1px 1px 3px #000;
-webkit-box-shadow: inset 1px 1px 3px #000;
box-shadow: inset 1px 1px 3px #000;
}
角丸 {
border-radius: 8px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
}
トランジション {
-webkit-transition: 1.5s;
-moz-transition: 1.5s;
-o-transition: 1.5s;
transition: 1.5s;
}
透明 {
filter: alpha(opacity=25);
-moz-opacity:0.25;
opacity:0.25;
}
背景のみ透明 {
background-color:rgba(255,255,255,0.2);
}
グラデーション {
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#ffffff', endColorstr = '#000000');
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr = '#ffffff', endColorstr = '#000000')";
background-image: -moz-linear-gradient(top, #ffffff, #000000);
background-image: -ms-linear-gradient(top, #ffffff, #000000);
background-image: -o-linear-gradient(top, #ffffff, #000000);
background-image: -webkit-gradient(linear, center top, center bottom, from(#ffffff), to(#000000));
background-image: -webkit-linear-gradient(top, #ffffff, #000000);
background-image: linear-gradient(top, #ffffff, #000000);
}
スマホ対応
@media screen and (max-width: 480px){
}
@media screen and (max-width: 320px){
}
時々使うCSS3 end */