美文网首页
css拾遗(11)-全局默认样式

css拾遗(11)-全局默认样式

作者: 姜治宇 | 来源:发表于2022-04-20 13:01 被阅读0次
:root {
    box-sizing: border-box;
}

*,
::before,
::after {
    box-sizing: inherit;
}

body {
    background: lightblue;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    font-size: 14px;
}

body * + * { /*全局设置上下边距*/
    margin-top: 20px;
}
/*去除所有标签的默认样式*/
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;
}

ol,
ul {
    list-style: none;
}

a {
    color: #333;
    text-decoration: none;
}

blockquote,
q {
    quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
    content: '';
    content: none;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

/*如果用float布局,清除浮动*/ 
.clearfix::before,
.clearfix::after { 
    display: table;
    content: " ";
}
.clearfix::after {
    clear: both;
}

相关文章

网友评论

      本文标题:css拾遗(11)-全局默认样式

      本文链接:https://www.haomeiwen.com/subject/ahrsertx.html