當我申請位置固定到我的標題。正文內容與標題重疊!爲什麼會發生?而且,我該如何解決這個問題?它發生在Firefox和Chrome上。我添加了代碼,只有css有什麼問題?職位:固定; css不工作
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;
}
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
width: 1351px;
}
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;
}
body {
color: #A2A2A2;
padding-top: 0px;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
position:relative;
z-index:-1;
}
a {
color: #0090D8;
text-decoration: none;
}
a:hover,
a:focus {
text-decoration: underline;
}
#container {
width: 100%;
margin: auto;
padding: 0px;
background-color:#EBEBEB;
position:fixed;
}
header {
font-family: 'Open Sans', 'Helvetica Neue', helvetica, arial, sans-serif;
font-weight: 300;
}
header:after {
content: '';
display: block;
clear: both;
}
header #logo {
float: left;
color: #0090D8;
padding-top: 17px;
font-size: 30px;
font-style: 700;
padding-left: 15px;
}
header nav {
margin-top: 3em;
float: right;
}
header nav ul {
margin: 0;
padding-bottom:0px;
float: right;
}
header nav li {
display: inline;
}
header nav li + li {
padding-left: 4px;
}
可能是z-index問題。需要看一些代碼。 – davidpauljunior
'position:fixed'將元素從文檔流中提取出來,因此您需要保留其他內容,例如使用margin或padding。 –
我添加了一些代碼 – user3340039