当我设置position:fixed
到我的标题时,它消失了,我不知道为什么。这是我的代码:
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>
<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>