这是标题 DIV 的 CSS:
#header {
display: block;
float: left;
min-width: 100%;
min-height: 170px;
height: auto;
background-color: #030309;
background-color: #191718;
position:fixed;
margin-top: -210px;
z-index: 999999;
opacity:.76;
-webkit-transition: opacity 1s ease-in-out;
-moz-transition: opacity 1s ease-in-out;
-o-transition: opacity 1s ease-in-out;
-ms-transition: opacity 1s ease-in-out;
transition: opacity 1s ease-in-out;
top: 0;
}
这是悬停状态:
#header:hover {
display:block;
opacity:1;
-webkit-transition: opacity 1s ease-in-out;
-moz-transition: opacity 1s ease-in-out;
-o-transition: opacity 1s ease-in-out;
-ms-transition: opacity 1s ease-in-out;
transition: opacity 1s ease-in-out;
}
我想要做的是默认情况下隐藏标题并在悬停时显示。我尝试不断添加,display: none
但它不起作用。我也尝试过on和on但它不行,因为标题下方的内容保持固定并且从页面顶部不可见。#header
display:block;
#header:hover
opacity:0;
#header
opacity:1;
#header:hover
一些建议?