如何摆脱我没有分配的保证金?

时间:2014-09-24 18:49:42

标签: css margins

这就是我在css中的全部内容:

    .menu {
    background-color: black;
    color: white;
    height: 100px;
    opacity: 0.5;
}

html {
     background-image: url('image.jpg');
     background-size:cover;
}

但由于某种原因,这个酒吧仍然有利润。为什么?我的div中没有​​任何文字或任何内容。

1 个答案:

答案 0 :(得分:0)

所有浏览器都有" major"的默认边距。元素,它可能就是你所看到的。尝试在css的开头添加它以重置所有这些并在浏览器中更加一致地工作:

/* css reset */
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;
}