即使使用CSS重置,Div也不会触及浏览器的顶部

时间:2017-04-20 16:53:14

标签: html css

我正在制作一个项目,我需要创建一个div,用户可以更改他的图片,所以,我这样做了:

<div class="mudar_foto_form" style="z-index: 5; position: fixed; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5);">
</div>

但是,div没有达到页面顶部: http://prntscr.com/eys8lp

我甚至试图使用:

html, body {
        margin: 0px;
        padding: 0px;
        border: 0px;
    }

即便如此,css重置:

@charset "utf-8";
/* CSS Document */
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;
}

但仍然没有触及页面顶部的任何建议?

1 个答案:

答案 0 :(得分:0)

所以,我忘了做顶:0,感谢Niet the Dark Absol和wlin