我在我的网站的'nav'中有一个'register'div,而在firefox中,一切都很完美,但在其他浏览器(如Chrome)中,定位有时会完全关闭,但如果我刷新页面,它会修复本身。
另外,如果我检查元素并检查/取消选中'position:absolute',它通常会转到正确的位置。
这里有很多纠缠的代码,所以我提前道歉,并希望得到任何帮助!
我将在下面发布相关代码,但如果您需要查看完整代码,请转到www.mindmote.com/nav/index.php
HTML:
<header>
<img src="..." onclick="location.href='../nav/index.php'" />
</header>
<nav>
<ul class="fancyNav">
...
</ul>
<div class="register">
<a class="unlink" id='windowbox' style='border-radius: 10px;width:45px;' href="...">Register</a>
<a class="unlink" id='windowbox' style='border-radius:10px;width:40px;' href="...">Log In</a>
</div>
</nav>
CSS:
.register{
position: absolute;
display: inline;
width:auto;
height:auto;
margin: 5px;
font-size: 18px/20px;
}
a.unlink{
color:#0f0000;
text-decoration: none;
clear: both;
}
a:hover.unlink{
color:#ecf7ed;
text-decoration: none;
clear:both;
}
#windowbox{
border-bottom-left-radius:10px;
border-bottom-right-radius:10px;
margin-left: auto;
margin-right: auto;
padding: 5px;
width :auto;
height:auto;
background: #c3912b url('../assets/img/nosp.png') repeat;
border: 1px solid #666666; /***/
-webkit-box-shadow: 5px 5px 10px .5px rgba(100, 100, 100, .3);
box-shadow: 5px 5px 10px .5px rgba(100, 100, 100, .3);
}
.fancyNav{
position: relative;
text-align: start;
display: inline;
margin: 0;
padding: 15px 4px 17px 0;
list-style: none;
-webkit-box-shadow: 5px 5px 10px .5px rgba(100, 100, 100, .3);
box-shadow: 5px 5px 10px .5px rgba(100, 100, 100, .3);
}
答案 0 :(得分:0)
删除绝对定位,它应该没问题。