我为我的标题编写了一个代码,当你将标题悬停时,它会将其宽度调整为300px,现在我只想在width = 300px时添加文本,或者在将文本悬停后调整标题时缓慢添加文本鼠标。
这是我写的代码。 CSS:
#header {width: 5px; height: calc(100vh - 30px); text-align: center; transition: width 0.5s ease-out; -o-transition: width 0.5s ease-out; -ms-transition: width 0.5s ease-out; -moz-transition: width 0.5s ease-out; -webkit-transition: width 0.5s ease-out;} #header:hover {width: 300px; background: #171C21;}
HTML:
BEGIN
UPDATE Person
SET [CompanyLogo] = (SELECT TestCompanyLogo.*
FROM OPENROWSET(BULK 'd:\test.png', SINGLE_BLOB) TestCompanyLogo)
END
如果有任何方法可以在CSS中使用,我正在寻找一种CSS方法。
答案 0 :(得分:3)
我认为这应该是有用的。
#header {
width : 10px ;
height : calc(100vh - 30px) ;
text-align : center ;
transition : width 0.5s ease-out ;
-o-transition : width 0.5s ease-out ;
-ms-transition : width 0.5s ease-out ;
-moz-transition : width 0.5s ease-out ;
-webkit-transition : width 0.5s ease-out ;
background : #171C21 ;
overflow : hidden ;
color : white ;
}
#header:hover {
width : 300px ;
}
#textContent{
visibility : hidden;
}
#header:hover #textContent{
visibility : visible;
}

<div id="header">
<div id="textContent">
<p>test</p>
<p>test</p>
<p>test</p>
<div/>
</div>
&#13;
答案 1 :(得分:0)
您可以使文字完全透明,使其颜色值为color: rbga(0, 0, 0, 0.0);
,并使文字悬停在color: rbga(0, 0, 0, 1.0);
这是一个展示http://codepen.io/anon/pen/yeggKO { (已编辑,现在悬停时也有300px宽度)
答案 2 :(得分:0)
你可以做一件事:
div
hidden
hover
#header
个display : block
加上#header {width: 5px; height: calc(100vh - 30px); text-align: center; transition: width 0.5s ease-out; -o-transition: width 0.5s ease-out; -ms-transition: width 0.5s ease-out; -moz-transition: width 0.5s ease-out; -webkit-transition: width 0.5s ease-out;}
#header .hiddencontent{display:none;}
#header:hover {width: 300px; background: #171C21;}
#header:hover .hiddencontent{display:block;}
元素。
以下是一个小例子:
<div id="header">
<p>test</p>
<p>test</p>
<p>test</p>
<div class="hiddencontent">
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
</div>
</div>
{{1}}
答案 3 :(得分:0)
好吧,一切似乎都解决了,但是标题的悬停效果出了问题。当我取下标题的鼠标时,它没有动画回到原来的宽度,它会在没有动画的情况下返回。
html, body {background: #1A2026; font-family: "Open Sans", "sans-serif";}
* {margin: 0; padding: 0;}
a {display: block;}
/* DESKTOP */
#header {width: 5px; height: calc(100vh - 30px); padding-top: 10px; color: rgba(255,255,255,0.0); text-align: center; transition: width 0.5s ease-out; -o-transition: width 0.5s ease-out; -ms-transition: width 0.5s ease-out; -moz-transition: width 0.5s ease-out; -webkit-transition: width 0.5s ease-out;}
#header:hover {width: 300px; background: #171C21; color: rgba(255,255,255,1.0);}
#header .hidden {display:none;}
#header .hidden > p {font-size: 16px; text-transform: uppercase; margin-bottom: 10px; font-weight: 600;}
#header .hidden > a {margin-top: 5px; text-decoration: none; color: #fff; font-weight: 600;}
#header .hidden > a:hover {color: #27ae60;}
#header:hover .hidden {display:block;}
#footer {width: 100%; height: auto; bottom: 0px; position: absolute;}
#footer .copyright {height: 30px; background: #171C21; line-height: 30px;}
#footer .copyright > p {color: #fff; text-align: center; font-size: 13px;}