我正在做一个元素,我需要创建一个 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/