how to make my horizontal css dock navigation to vertical
I can now see the text/caption after changing some codes. The problem now is that, instead of vertical, i have it on horizo开发者_C百科ntal. Please help me on how to transform the dock navigation to vertical. Thank you :)
Here are the codes I used:
*CSS
#navigation {
float:left;
width:200px;
height:300;
}
.expand-down {
font-family:Arial, Helvetica, sans-serif;
line-height:normal;
margin-top:20px;
height:150px;
width:500px;
margin-bottom:30px;
}
.expand-down * {
margin: 0;
padding: 0;
}
.expand-down ul {
padding-top:10px;
margin-left:10px;
}
.expand-down ul li {
float:left;
list-style-type:none;
}
.expand-down ul li a {
text-decoration:none;
}
.expand-down ul li a img {
width:70px;
height:70px;
border:none;
}
.expand-down ul li a span {
display:none;
}
.expand-down ul li:hover a span {
display:block;
font-size:16px;
text-align:center;
color:red;
}
.expand-down ul li:hover a img {
width:120px;
height:120px;
}
.expand-down ul li:hover + li a img {
width:70px;
height:70px;
}
.expand-down ul li:hover + li + li a img {
width:60px;
height:60px;
}
*HTML
<div id="navigation">
<div class="expand-down" align="left">
<ul>
<li>
<a href="timaHOME.php" onClick="playSound("beep-02.wav");"><img src="home icon1.png"/><span>HOME</span></a>
</li> <br />
<li>
<a href="timaREGISTER.php" onClick="playSound("beep-02.wav");"><img src="profile icon.png"/><span>REGISTER</span></a>
</li>
<br />
<li>
<a href=""><img src="report icon.png"/><span>REPORTS</span></a>
</li> <br />
</ul>
</div>
</div>
Remove this float:left;
.expand-down ul li {
float:left; //REMOVE
list-style-type:none;
}
http://jsfiddle.net/jasongennaro/2pyu3/
EDIT
To make the caption line up beside the image, add a display:inline-block;
.expand-down ul li:hover a span {
display:inline-block; //CHANGE THIS
http://jsfiddle.net/jasongennaro/2pyu3/1/
Try this
.expand-down ul li {
list-style-type:none;
}
.expand-down ul li:hover a span {
display:block;
font-size:16px;
text-align:left;
color:red;
}
see example
精彩评论