这是我的 jsfiddle 代码 http://jsfiddle.net/jspence29/VqZSw/ 但似乎它不起作用所以我会给你我的代码
#links ul
{
margin-left: auto;
position: fixed;
margin-right: auto;
}
#links ul li
{
margin-left: 200px;
font-family: sans-serif:
background-color: #fff;
display: inline;
width: 25px;
}
#links ul li a
{
background-color: #fff;
opacity: 0.8;
filter: alpha(opacity=80);
color: #ffffff;
text-align: center;
width: 25px;
padding: 10px;
font-family: sans-serif;
text-decoration: none;
position: relative;
top: 180px;
overflow: hidden;
transition:width .5s;
-moz-transition:width .5s; /* Firefox 4 */
-webkit-transition:width .5s; /* Safari and Chrome */
-o-transition:width .5s; /* Opera */
}
#links ul li a:hover
{
color: #000;
width: 50px;
}
</style>
<head>
<body>
<div id="background" >
<div id="menuButton" onclick="showMenu()" >
<p><span style="cursor:pointer">Menu </span></p>
</div>
<div id="menu" style="display: none;">
<h1> Singapore </h1>
<p>ever onward, singapore </p>
<ul>
<li> <a href="http://www.spencedesign.netau.net/singapore.html" > Gallery <span class="show">
Click to see pictures of the most elegant city in the world </span> </a> </li>
<li> <a href="http://www.spencedesign.netau.net/singapore.html" > Tour <span class="show">
Click to take a tour of the one of a kind singapore</span> </a> </li>
<li> <a href="http://www.spencedesign.netau.net/singapore.html" > Facts <span class="show">
Click to learn astounding facts of the one and only singapore</span> </a> </li>
<li> <a href="http://www.spencedesign.netau.net/singapore.html" > Author <span class="show">
Click to learn about me, and see my works cited page </span></a> </li>
</ul>
</div><!--Menu-->
<div id="links" >
<ul>
<li> <a href="http://www.spencedesign.netau.net/singapore.html" > Gallery </a></li>
<li> <a href="http://www.spencedesign.netau.net/singapore.html" > Tour </a></li>
<li> <a href="http://www.spencedesign.netau.net/singapore.html" > Facts </a></li>
<li> <a href="http://www.spencedesign.netau.net/singapore.html" > Author </a></li>
</ul>
</div>
</div><!--Background-->
</body>
</html>
以及指向我的页面的链接http://www.spencedesign.netau.net/singaporehomemenu.html
所以,我的问题是,当您将鼠标悬停在顶部的按钮上时,宽度会发生变化。但是当你在底部链接上这样做时,它不会。它应该改变,因为我使用了相对相同的代码。所以我不知道问题是什么。我已经仔细检查了大约半小时的代码,但找不到修复程序。我知道我的 CSS/HTML 编码很粗略,但我是初学者,我认为我通过你们学习得越多,我就会越好。谢谢你的时间,如果你看过我的其他帖子,我很抱歉发了这么多,我想你可以说我在我的网站计划中超出了我的头脑。