0
我正在做一個項目,我需要創建的div上升,其中用戶可以改變他的照片,所以,我這樣做:股利不觸及瀏覽器甚至CSS的頂端重置
<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;
}
但仍然沒有觸及頁面的頂部,有什麼建議嗎?
你能在的jsfiddle或類似上傳你的代碼?設置'top:0; left:0; width:100%; height:100%'應該可以解決你的問題,但是很高興看到你當前的代碼工作到目前爲止。 –
嗯......'top:0;'? – aahhaa
嘗試添加'left:0; top:0' - 你沒有給你的元素一個位置,所以瀏覽器必須猜測你的意思。 –