首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Bootstrap品牌图像显示过大

Bootstrap品牌图像显示过大
EN

Stack Overflow用户
提问于 2017-05-27 01:54:19
回答 2查看 1.4K关注 0票数 0

也许这是我的css,但我的代码应该以固定大小显示标题中的图像。但是,它看起来可能在div之外。这是代码。

代码语言:javascript
复制
        <div class="row">
        <div class="col-md-12 top navbar-fixed-top">
                <div class="col-md-6">

    <nav class="navbar navbar-default" role="navigation">
                    <div class="navbar-header">

                        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                            <span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
                        </button> 
    <a class="navbar-brand" href="#"><img class="img-responsive" src="http://dev-httpwwwrestechsyscom.pantheonsite.io/sites/all/themes/myWay/logo.png"></a>
    </div></nav></div>

                <div class="col-md-6">  
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                        <ul class="nav navbar-nav">
                            <ul class="menu"><li class="first expanded dropdown active"><a href="/" title="" class="dropdown-toggle active" data-toggle="dropdown" data-target="#">About Us <span class="caret"></span></a><ul class="dropdown-menu"><li class="first leaf active"><a href="/" title="" class="active">Mission Statement</a></li>
    <li class="leaf"><a href="http://dev-httpwwwrestechsyscom.pantheon.io/content/meet-our-team" title="">Meet Our Team</a></li>
    <li class="leaf"><a href="/content/testimonials" title="">Testimonials</a></li>
    <li class="last leaf"><a href="/profiles-football" title="">Sample Athletes Profile</a></li>
    </ul></li>
    <li class="leaf"><a href="/content/eligibility-requirements">Eligibility</a></li>
    <li class="expanded dropdown"><a href="/content/recruiting-info" class="dropdown-toggle" data-toggle="dropdown" data-target="#">Recruiting <span class="caret"></span></a><ul class="dropdown-menu"><li class="first leaf"><a href="http://dev-httpwwwrestechsyscom.pantheon.io/content/recruiting-faq" title="">Recruiting FAQ</a></li>
    <li class="last leaf"><a href="http://dev-httpwwwrestechsyscom.pantheon.io/content/recruiting-info" title="">Recruiting Info</a></li>
    </ul></li>
    <li class="last leaf"><a href="/content/elite-membership">Services</a></li>
    </ul><li class="active"></li>

                        </ul>

                    </div>

            </div></div></div>
EN

回答 2

Stack Overflow用户

发布于 2017-05-27 01:57:46

你可以用这种方式修复它。只需添加所需的高度到品牌形象和宽度将自动基于高度。例如:

代码语言:javascript
复制
.navbar-brand img {
   height: 30px;
}
票数 0
EN

Stack Overflow用户

发布于 2017-05-27 02:01:51

您可以向.navbar-brand img元素添加一个max-height: 100%,它将包含.navbar-brand中的图像。.navbar-brandheight是来自bootstrap的css的50px,因此要使其更大,请更改.navbar-brandheight

代码语言:javascript
复制
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<style>
.navbar-brand img {
  max-height: 100%;
}

/* add/change this if you want to make the navbar brand area bigger */
.navbar-brand {
  height: 100px;
}
</style>
<div class="row">
  <div class="col-md-12 top navbar-fixed-top">
    <div class="col-md-6">

      <nav class="navbar navbar-default" role="navigation">
        <div class="navbar-header">

          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                            <span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
                        </button>
          <a class="navbar-brand" href="#"><img class="img-responsive" src="http://dev-httpwwwrestechsyscom.pantheonsite.io/sites/all/themes/myWay/logo.png"></a>
        </div>
      </nav>
    </div>

    <div class="col-md-6">
      <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
        <ul class="nav navbar-nav">
          <ul class="menu">
            <li class="first expanded dropdown active"><a href="/" title="" class="dropdown-toggle active" data-toggle="dropdown" data-target="#">About Us <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li class="first leaf active"><a href="/" title="" class="active">Mission Statement</a></li>
                <li class="leaf"><a href="http://dev-httpwwwrestechsyscom.pantheon.io/content/meet-our-team" title="">Meet Our Team</a></li>
                <li class="leaf"><a href="/content/testimonials" title="">Testimonials</a></li>
                <li class="last leaf"><a href="/profiles-football" title="">Sample Athletes Profile</a></li>
              </ul>
            </li>
            <li class="leaf"><a href="/content/eligibility-requirements">Eligibility</a></li>
            <li class="expanded dropdown"><a href="/content/recruiting-info" class="dropdown-toggle" data-toggle="dropdown" data-target="#">Recruiting <span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li class="first leaf"><a href="http://dev-httpwwwrestechsyscom.pantheon.io/content/recruiting-faq" title="">Recruiting FAQ</a></li>
                <li class="last leaf"><a href="http://dev-httpwwwrestechsyscom.pantheon.io/content/recruiting-info" title="">Recruiting Info</a></li>
              </ul>
            </li>
            <li class="last leaf"><a href="/content/elite-membership">Services</a></li>
          </ul>
          <li class="active"></li>

        </ul>

      </div>

    </div>
  </div>
</div>

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44207554

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档