我正在尝试将导航栏品牌形象添加到我的网站。徽标似乎不适合导航栏。要么它太大要么太小(当我设置height:100%
)
这是我的导航栏html:
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#collapse" aria-expanded="false">
<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 img-responsive" src="www/images/srs.png" alt="SRS Constructions">
</a>
</div>
<div class="collapse navbar-collapse navbar-right" id="collapse">
<ul class="nav navbar-nav">
<li class="active"><a class="main" href="#main">Home <span class="sr-only">(current)</span></a>
<div class="nav-line"></div>
</li>
<li class="dropdown" id="nav-about">
<a href="#about" class="dropdown-toggle main" role="button" aria-haspopup="true" aria-expanded="false">About
</a>
<ul class="dropdown-menu">
<li><a href="about.html">The Founder</a></li>
<li role="separator" class="divider"></li>
<li><a href="health-policy.html">HSE Policy</a></li>
<li><a href="quality-policy.html">Quality Policy</a></li>
</ul>
<div class="nav-line"></div>
</li>
<li><a class="main" href="#services">Services</a>
<div class="nav-line"></div>
</li>
<li><a class="main" href="#projects">Our Projects</a>
<div class="nav-line"></div>
</li>
<li><a class="main" href="#whyus">Why Us</a>
<div class="nav-line"></div>
</li>
<li><a class="main" href="#contact">Contact</a>
<div class="nav-line"></div>
</li>
</ul>
</div>
</div>
</nav>
我的导航栏css:
.navbar {
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.3);
}
.navbar-default .navbar-nav {
font-size: 15px;
}
.navbar-fixed-top {
min-height: 80px;
}
.navbar-nav>li {
position: relative;
}
.navbar-nav>li>a {
padding-top: 0px;
padding-bottom: 0px;
line-height: 80px;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
color: #fff;
background-color: #b4a28f;
}
.navbar-default .navbar-nav .dropdown-menu {
left: 0;
right: auto;
}
.dropdown-menu>.active>a,
.dropdown-menu>.active>a:hover,
.dropdown-menu>.active>a:focus {
color: #ffffff;
text-decoration: none;
outline: 0;
background-color: #b4a28f;
}
@media (min-width: 768px) {
.navbar-nav>li>.nav-line {
position: absolute;
bottom: -1px;
left: 0;
background-color: #3178b9;
height: 3px;
width: 0%;
}
.navbar-nav>li:hover>.nav-line {
background-color: #3178b9;
height: 3px;
width: 100%;
-webkit-transition: all 200ms ease-in;
-moz-transition: all 200ms ease-in;
-o-transition: all 200ms ease-in;
transition: all 200ms ease-in;
}
.navbar-nav>li.active>.nav-line {
background-color: transparent;
}
}
@media (max-width: 767px) {
.navbar-nav > li > a {
line-height: 30px;
padding-top: 10px;
padding-bottom: 10px;
}
#footer {
color: #2e2e2e;
}
}
我会使用500px*536px
图片或551px*76px
图片。我希望图像也能响应。可以查看工作版本here。
请帮助我将图像固定在导航栏高度内。
答案 0 :(得分:0)
试试这个
CSS
.navbar-brand
{
padding: 4px 0px;
height: 80px;
display: block;
float: none;
}
.navbar-brand>img {
display: block;
max-height: 100%;
max-width: 100%;
margin: auto 40%;
}
希望这会有所帮助..
答案 1 :(得分:0)
output$ngram_res_panel <- renderUI({
tagList(
fluidRow(
column(selectInput("box1",NULL,choices = c("choose",ngram$results[[1]]$th),selected = input$box1,selectize=FALSE),width=5
)
),
lapply(2:length(ngram$results), function(i) {
tagList(
fluidRow(
column(selectInput(inputId = paste0("box", i), label = NULL,
choices = c("choose",ngram$results[[i]]$th[which(ngram$results[[i]]$V1 == ngram$results[[i-1]]$last[
which(input[[paste0("box", i-1)]] == ngram$results[[i-1]]$th)
])
]),selected = input[[paste0("box", i)]],selectize=FALSE
),width = 5)
)
)
})
)
})
答案 2 :(得分:0)
Solution:
.navbar-brand img{
width: 100%;
height: 100px; /*** As per Your Requirement ***/
}