好的,我有,
<ul class="vertmenu">
<li><a href="#" class="icon-logo">Logo</a></li>
<li><a href="#" class="icon-profile"><span>About</span></a></li>
<li><a href="#" class="icon-bubbles2"><span>Connect</span></a></li>
<li><a href="#" class="icon-images">Designs</a></li>
<li><a href="#" class="icon-insert-template">Templates</a></li>
<li><a href="#" class="icon-star3">Effects</a></li>
<li><a href="#" class="icon-code">Tutorials</a></li>
</ul>
我的CSS看起来像这样:
.vertmenu {
position: fixed;
overflow: hidden;
top: 0;
left: 0;
height: 100%;
list-style-type: none;
margin: 0;
padding: 0;
background: #383433;
}
.vertmenu li a {
display: block;
text-indent: -500em;
height: 5em;
width: 5em;
line-height: 5em;
text-align: center;
color: #e9e5da;
position: relative;
border-bottom: 1px solid rgba(0,0,0,0.05);
-webkit-transition: background 0.1s ease-in-out;
-moz-transition: background 0.1s ease-in-out;
transition: background 0.1s ease-in-out;
}
.vertmenu li a:hover,
.vertmenu li:first-child a{
background: #282322;
color: #fff;
}
/* class for current item */
.vertmenu li.vertmenucurrent a {
background: #282322;
color: #e9e5da;
}
.vertmenu li a:before {
font-family: 'icomoon';
speak: none;
font-style: normal;
font-weight: normal;
text-indent: 0em;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
font-size: 1.4em;
-webkit-font-smoothing: antialiased;
}
.vertmenu li a.icon-logo:before {
content: "V";
font-weight: 300;
font-size: 300%;
font-family: 'Oswald', sans-serif;
}
这是一个微妙的垂直菜单,位于页面左侧。现在元素包含&#34; icomoon&#34;字体,只有这个,所以没有解释按钮的真正含义。当我将鼠标悬停在li?
上时,是否可以将文本显示在相应父级的右侧?JSFIDDLE:http://jsfiddle.net/dpNw7/1/
答案 0 :(得分:1)
试着看看这个
<ul class="vertmenu">
<li><a href="#" class="icon-logo"><span>Logo</span></a></li>
<li><a href="#" class="icon-profile"><span>About</span></a></li>
<li><a href="#" class="icon-bubbles2"><span>Connect</span></a></li>
<li><a href="#" class="icon-images">Designs</a></li>
<li><a href="#" class="icon-insert-template">Templates</a></li>
<li><a href="#" class="icon-star3">Effects</a></li>
<li><a href="#" class="icon-code">Tutorials</a></li>
</ul>
CSS
.vertmenu {
position: fixed;
/*overflow: hidden;*/
top: 0;
left: 0;
height: 100%;
list-style-type: none;
margin: 0;
padding: 0;
background: #383433;
}
.vertmenu li a {
display: block;
color:#ccc;
text-indent: -500em;
height: 5em;
width: 5em;
line-height: 5em;
text-align: center;
color: #e9e5da;
position: relative;
/*text-shadow: 0px 0px 3px #000;*/
border-bottom: 1px solid rgba(0,0,0,0.05);
-webkit-transition: background 0.1s ease-in-out;
-moz-transition: background 0.1s ease-in-out;
transition: background 0.1s ease-in-out;
}
.vertmenu li a:hover{
text-indent: 0px;
}
.vertmenu li a:hover,
.vertmenu li:first-child a{
background: #282322;
color: #fff;
}
.icon-logo:hover span{visibility:hidden}
.vertmenu li a:hover span {
position: absolute;
color: #000;
top: 0;
left: 90px;
}
/* class for current item */
.vertmenu li.vertmenucurrent a {
background: #282322;
color: #e9e5da;
}
.vertmenu li a:before {
font-family: 'icomoon';
speak: none;
font-style: normal;
font-weight: normal;
text-indent: 0em;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
font-size: 1.4em;
-webkit-font-smoothing: antialiased;
}
.vertmenu li a.icon-logo:before {
content: "V";
font-weight: 300;
font-size: 300%;
font-family: 'Oswald', sans-serif;
}
/* (depends on total height of menu) */
@media screen and (max-height: 34.9375em) {
.cbp-vimenu {
font-size: 70%;
}
}
答案 1 :(得分:1)
所以我试着在这方面付出一些努力,这是你想要解决的问题吗?
我接受了DACrosby以前的编辑并编辑了一些我自己的编码。
希望这会对你有所帮助。您只需使用margin
调整链接文本即可。
HTML
<ul class="vertmenu">
<center>
<li><a href="#" class="icon-logo">Logo</a></li>
<li><a href="#" class="icon-profile"><img src="http://placehold.it/45x45" /><div>About</div></a></li>
<li><a href="#" class="icon-bubbles2"><img src="http://placehold.it/45x45" /><div>Connect</div></a></li>
<li><a href="#" class="icon-images"><img src="http://placehold.it/45x45" /><div>Designs</div></a></li>
<li><a href="#" class="icon-insert-template"><img src="http://placehold.it/45x45" /><div>Templates</div></a></li>
<li><a href="#" class="icon-star3"><img src="http://placehold.it/45x45" /><div>Effects</div></a></li>
<li><a href="#" class="icon-code"><img src="http://placehold.it/45x45" /><div>Tutorials</div></a></li>
</center>
</ul>
CSS
ul li img{
margin: 13px 0 0 17px;
position: absolute;
display: none;
}
.vertmenu li:hover img{
display: block;
}
.vertmenu li:hover div{
position: absolute;
margin: 27px 0 0 0;
text-align: center;
}
.vertmenu {
position: fixed;
overflow: hidden;
top: 0;
left: 0;
height: 100%;
list-style-type: none;
margin: 0;
padding: 0;
background: #383433;
}
.vertmenu li a {
display: block;
color:#ccc;
text-indent: -500em;
height: 5em;
width: 5em;
line-height: 5em;
text-align: center;
color: #e9e5da;
position: relative;
text-shadow: 0px 0px 3px #000;
border-bottom: 1px solid rgba(0,0,0,0.05);
-webkit-transition: background 0.1s ease-in-out;
-moz-transition: background 0.1s ease-in-out;
transition: background 0.1s ease-in-out;
}
.vertmenu li a:hover{
text-indent: 0px;
}
.vertmenu li a:hover,
.vertmenu li:first-child a{
background: #282322;
color: #fff;
}
/* class for current item */
.vertmenu li.vertmenucurrent a {
background: #282322;
color: #e9e5da;
}
.vertmenu li a:before {
font-family: 'icomoon';
speak: none;
font-style: normal;
font-weight: normal;
text-indent: 0em;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
font-size: 1.4em;
-webkit-font-smoothing: antialiased;
}
.vertmenu li a.icon-logo:before {
content: "V";
font-weight: 300;
font-size: 300%;
font-family: 'Oswald', sans-serif;
}
/* (depends on total height of menu) */
@media screen and (max-height: 34.9375em) {
.cbp-vimenu {
font-size: 70%;
}
}