简体   繁体   English

如何在导航栏中获取我的导航链接?

[英]How do I get my nav links in the nav bar?

I'm not sure why this is happening.我不确定为什么会这样。 The tag that is the title "Don't Be Square" is in the nav bar, but not the links.标题为“Don't Be Square”的标签在导航栏中,但不在链接中。 What am I missing here in the CSS or the HTML that will bump it up inside there?我在 CSS 或 HTML 中遗漏了什么,将其插入其中? enter image description here在此处输入图片说明

I think, you have header "Don't Be Square" after that you are righting code for Nav bar.我认为,在您为导航栏校正代码之后,您有标题“不要方形”。 And you wanted to bring your nav bar top right.你想把你的导航栏放在右上角。 To do so, you can right css for your title.为此,您可以为标题设置正确的 css。 use float: left;使用浮动:左; there other way also you can acheive, for that you have to share the code.您还可以通过其他方式实现,因为您必须共享代码。

Hope it will help you.希望它会帮助你。

It would help if you posted some of the source code along with it.如果您随附一些源代码,将会有所帮助。 The only thing that I can potentially think of by just the image is that you are using some sort of header (h1, h2, etc) followed by some other tag that isn't inline (div, p, etc).我唯一可以通过图像想到的是您正在使用某种标题(h1、h2 等),然后是其他一些非内联标签(div、p 等)。 Since both are block that could be why it displays on the line after.由于两者都是块,这可能就是为什么它显示在后面的行上。 If this is the problem, a tags are inline so simply putting the tags within the body of the h1 could suffice such as如果这是问题所在,标签是内联的,因此只需将标签放在 h1 的主体内就足够了,例如

<h1>Don't Be Square <a some link here/> <a another link/> <a third link></h1>

and then styling the links differently from the h1 by giving them an id or using the css identifier然后通过给它们一个 id 或使用 css 标识符来设置与 h1 不同的链接样式

h1 a{ your styling here}

Again I can't help much because there is no source but hopefully this helps.我再次帮不上忙,因为没有来源,但希望这会有所帮助。

This is just an example you may follow it这只是一个例子,你可以遵循它

 <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> </head> <body> <nav class="navbar navbar-default"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="#">Don't Be Square</a> </div> <ul class="nav navbar-nav" style="float: right;"> <li class="active"><a href="#">Home</a></li> <li><a href="#">Page 1</a></li> <li><a href="#">Page 2</a></li> <li><a href="#">Page 3</a></li> </ul> </div> </nav> </body> </html>

View it in full screen if not the navbar will wrap.如果不是导航栏将换行,则以全屏方式查看它。 Good luck祝你好运

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM