如何使我的水平css停靠导航到垂直

时间:2011-07-23 17:44:34

标签: javascript css navigation hover dock

我现在可以在更改一些代码后看到文字/标题。现在的问题是,而不是垂直,我在横向上。请帮助我如何将码头导航转换为垂直。谢谢:))

以下是我使用的代码:

*的 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>

2 个答案:

答案 0 :(得分:0)

试试这个

.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;
}

请参阅example

答案 1 :(得分:0)

删除此float:left;

.expand-down ul li {
  float:left; //REMOVE
  list-style-type:none;
}

http://jsfiddle.net/jasongennaro/2pyu3/

修改

要在图片旁边添加标题,请添加display:inline-block;

.expand-down ul li:hover a span {
  display:inline-block; //CHANGE THIS

http://jsfiddle.net/jasongennaro/2pyu3/1/