我遇到了一個問題,我一直在搜索幾個小時,試圖解決問題,但沒有成功 - 我瘋了。固定位置時頭部消失
當我設置位置:固定到我的標題,它消失了,我不知道爲什麼。任何幫助,將不勝感激。這裏是我的CSS:
------- HTML ---------
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="header">
<div id="header-title">
TITLE
</div>
<div id="header-navigation">
MENU
</div>
</div>
<div class="content-container">
<div class="post">
<img src="1.jpeg">
<h2 class="post">
Hello
</h2>
</div>
<div class="post">
<img src="1.jpeg">
<h2 class="post">
Hello
</h2>
</div>
<div class="post">
<img src="1.jpeg">
<h2 class="post">
Hello
</h2>
</div>
</div>
</body>
</html>
-------- --------- CSS -
html, body {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
#header {
position: fixed;
}
#header-title {
float: left;
}
#header-navigation {
float: right;
}
.content-container {
width: 100%;
columns: 3;
-webkit-columns: 3; /* Safari and Chrome */
-moz-columns: 3; /* Firefox */
column-gap:0px;
-moz-column-gap:0px;
-webkit-column-gap:0px;
column-fill: balance|auto;
}
.post {
display: block;
position: relative;
}
.post img {
width: 100%;
height: auto;
display: block;
}
.post h2 {
position: absolute;
display: none;
top: 50%;
text-align: center;
margin: 0 auto;
width: 100%;
color: #000;
font-family: 'Raleway', sans-serif;
font-size: 14px;
text-transform: uppercase;
font-weight: 500;
}
.post:hover img {
opacity: 0.15;
}
.post:hover h2 {
display: block;
}
感謝提前! =)
哪些瀏覽器(和版本)你有問題?你是否也可以使用html(或者你已經分離出來的有問題的部分)? – Homer6
@ Homer6 Chrome,safari和Firefox。當我懸停流的第一個(左上角)圖像時,會出現頁面標題和菜單項。但它出現在圖像的頂部,浮體被破壞,並且它不會在內容容器頂部之前「需要它自己的空間」...... – Niklas