【问题标题】:How do I put an image in the bootstrap 3 navbar instead of the brand text?如何在 bootstrap 3 导航栏中放置图像而不是品牌文本?
【发布时间】:2014-01-08 23:47:48
【问题描述】:

我正在使用 bootstrap3 构建我的第一个响应式 Web,一切都很好,只是我无法将导航放在我想要的位置。当屏幕调整大小时,它会移动并且移动屏幕更糟。我找不到在导航栏中使用图像而不是文本的任何说明..

【问题讨论】:

标签: twitter-bootstrap drop-down-menu navigation responsive-design


【解决方案1】:
<img id="my-img" src="">
    <nav></nav>
</img>

<style>
    #my-img{
        position: relative;
    }
    #my-img nav{
        position:absolute;
        bottom:0;
    }
</style>

您需要相对定位图像并将导航栏绝对定位在 img 内。

【讨论】:

    【解决方案2】:

    在导航栏标题中,使用类 .navbar-brand 的链接并将您的图像插入其中。此外,将您的图像声明为响应式,如下例所示。

    <nav class="navbar navbar-default" style="border:0px;margin:0px;">
        <div class="container-fluid" style="background-color:#175FAF;">
    
            <div class="navbar-header">
                <a class="navbar-brand" href="#"><img src="img/logo.jpg" alt="logo" class="img-responsive"></a>
            </div>
    
    
        </div>
    </nav>
    

    【讨论】:

      猜你喜欢
      • 2013-11-30
      • 1970-01-01
      • 2017-12-20
      • 1970-01-01
      • 1970-01-01
      • 2018-02-20
      • 2015-01-18
      • 2014-07-22
      • 1970-01-01
      相关资源
      最近更新 更多