简体   繁体   中英

Twitter Bootstrap: Text in navbar

According to the twitter bootstrap documentation , I should be able to "Wrap strings of text in a <p> tag for proper leading and color." When I do this, at any level under navbar it simply doesn't inherit any of the navbar classes. Wrapping the string in <a> tags renders it but it shouldn't be an anchor.

The string I'm trying to render is "Logged in as ... " .

您必须在导航栏中包含一个类以及p标签,如下所示:

<p class="navbar-text">Logged in as</p> 

这已在issue 2799中修复。

我必须添加<span class="navbar-text">以使格式与锚标记保持一致。

None of these answers or comments worked for me (latest one was 6+ years old), but what worked for me was the following:

  1. I had to use the <span> tag, not <p>
  2. I had to include the "nav-item" class on my list element itself

My final working code looks like this:

<li class="nav-item"><span class="navbar-text"><h5>{{first_name}}</h5></span></li>

Take my word for it, but the word "Sally" below does not change to hyperlink when hovered.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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