html - 即使使用 CSS Reset,Div 也不会触及浏览器的顶部

标签 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;
}

但仍然没有触及页面顶部,有什么建议吗?

最佳答案

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

关于html - 即使使用 CSS Reset,Div 也不会触及浏览器的顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43525502/

相关文章:

javascript - jQuery .hide() 不适用于我的数组

html - SCSS 图像路径不起作用

javascript - jQuery 在模式打开/关闭时添加或删除类

jquery - 如何在特定页面上更改导航栏的颜色?

html - 如何让图片停留在底部不上升

html - 滚动区域内的 Div 被滚动离开

css - 使用 vuetify 开发和生产之间的 #app css 不同

css - 元素如何使用屏幕全宽减去 60 像素?

html - CSS3 关键帧需要 5 张幻灯片

html - 使用 css 自定义单选按钮