如何使我的水平 CSS 停靠导航变为垂直
更改一些代码后,我现在可以看到文本/标题。现在的问题是,我不是垂直的,而是水平的。请帮助我了解如何将停靠栏导航转换为垂直导航。谢谢:)
这是我使用的代码:
*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>
I can now see the text/caption after changing some codes. The problem now is that, instead of vertical, i have it on horizontal. 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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
删除此
float:left;
http://jsfiddle.net/jasongennaro/2pyu3/< /a>
编辑
要使标题在图像旁边对齐,请添加
display:inline-block;
http://jsfiddle.net/jasongennaro/2pyu3/1/
Remove this
float:left;
http://jsfiddle.net/jasongennaro/2pyu3/
EDIT
To make the caption line up beside the image, add a
display:inline-block;
http://jsfiddle.net/jasongennaro/2pyu3/1/
尝试一下
示例
Try this
see example