导航栏内的CSS定位 [英] CSS Positioning Inside Navigation Bar

查看:226
本文介绍了导航栏内的CSS定位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习如何制作响应式网站,遵循这里的教程 - 这是我的演示项目),但我有一个问题:我不能在< nav> 内的< ul> 由于某种原因,当显示未设置为none时,所有(包括 #pull 链接)低于< nav> < ul> 。我想在< nav> < ul> 右侧的某个地方创建登录表单,我不能为我的生活弄明白如何做。

I am learning how to make a responsive website following a tutorial here -- this is my demo project) but I am having a problem: I cannot position anything to the right of the <ul> inside the <nav>. For some reason everything (including the #pull link when the display is not set to "none") falls below the <nav> and the <ul>. I want to make a login form somewhere to the right of the <ul> in the <nav> and I cannot for the life of me figure out how to do it at all.

我确定它只是一个基本的CSS定位问题,我不能弄清楚,因为我新的,但我只需要在< nav> 上放置更多的内容,我不知道如何。

Im sure its just a basic CSS positioning issue that I can't figure out because I am new to this, but I just need to place more content on the <nav> and I cannot figure out how to.

推荐答案

一切皆低于标题,因为您的ul在边上有自动边距。如果你想把你的拉链接在右边,你不介意使用绝对定位,你可以这样做:

Everything falls below the title because your ul has an automatic margin on the sides. If you wanted to put your pull link on the right and you do not mind using absolute positioning you could do something like this:

#pull {
 position: absolute;
 top: 0;
 right: 0;
}

这篇关于导航栏内的CSS定位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆