div 被按下
嘿伙计们,我正在制作一个网站,但由于某种原因,当他们离开窗口时,我的 div 标签被推下。例如,这是我的导航。
然后,当我缩小浏览器窗口时,它会执行此操作。
这些是与导航有关的属性。
.navigation_container {
margin: 0;
padding: 0;
position: relative;
padding-top: 30px;
}
.navigation {
height: 40px;
color: #FFFFFF;
font-size: 15px;
list-style: none;
}
.link {
height: 10px;
float: left;
position: relative;
margin-top: 15px;
margin-left: 15px;
text-decoration: none;
}
.link_a {
text-decoration: none;
padding: 10px;
}
还有我的 Html 代码供那些需要它的人使用。
<div class="navigation_container">
<div class="navigation">
<li class="link"><a class="link_a current" href="">Home</a></li>
<li class="link"><a class="link_a" href="">Features</a></li>
<li class="link"><a class="link_a" href="">Contact</a></li>
<li class="link"><a class="link_a" href="">Link1</a></li>
<li class="link"><a class="link_a" href="">Link2</a></li>
</div>
</div>
任何关于为什么会发生这种情况的帮助将不胜感激。
谢谢。
Hey guys i'm making a website but for some reason my div tags are being pushed down when they leave the window. For example, here is my navigation.
Then when I make the browser window smaller it does this.
These are the attributes to do with the navigation.
.navigation_container {
margin: 0;
padding: 0;
position: relative;
padding-top: 30px;
}
.navigation {
height: 40px;
color: #FFFFFF;
font-size: 15px;
list-style: none;
}
.link {
height: 10px;
float: left;
position: relative;
margin-top: 15px;
margin-left: 15px;
text-decoration: none;
}
.link_a {
text-decoration: none;
padding: 10px;
}
Also my Html code for those who want it.
<div class="navigation_container">
<div class="navigation">
<li class="link"><a class="link_a current" href="">Home</a></li>
<li class="link"><a class="link_a" href="">Features</a></li>
<li class="link"><a class="link_a" href="">Contact</a></li>
<li class="link"><a class="link_a" href="">Link1</a></li>
<li class="link"><a class="link_a" href="">Link2</a></li>
</div>
</div>
Any help as to why this is happening would be appreciated.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您没有发布任何 html,因此这里有点盲目,但请指定一个最小宽度以防止它们换行。
You posted none of your html, so bit of a shot in the dark here, but specify a min-width to keep them from wrapping.
我建议您的导航栏不要使用 div,而是使用水平列表。更少的 html,更干净的代码。
这是一个示例:http://css.maxdesign.com.au/listutorial/horizontal_master。嗯
I would suggest not using divs for your nav bar, but to use horizontal lists. Less html, cleaner code.
Here is a example: http://css.maxdesign.com.au/listutorial/horizontal_master.htm