Im пытается добавить изображение в ontop bootstrap navbar, однако я не могу добавить его с дополнительными «барами» на nav.Изображение ontop bootstrap nav bar
ответ
Вы можете создать изображение в навигационной панели, поскольку используете фиксированную позицию для навигации. Это сообщение может также помочь с другими функциями, похоже, вы пытаетесь реализовать: SO Bootstrap Search Bar
$(".btn-search").click(function(e) {
$("#search-input, #btn-go").fadeToggle();
});
$(".hasclear").keyup(function() {
var t = $(this);
t.next('span').toggle(Boolean(t.val()));
});
$(".clearer").hide($(this).prev('input').val());
$(".clearer").click(function() {
$(this).prev('input').val('').focus();
$(this).hide();
});
body {
height: 100%;
}
.banner {
padding-bottom: 10px;
text-align: center;
background: white;
}
.banner img {
height: 100px;
}
.navbar.navbar-custom {
border: none;
border-top: 6px solid #266080;
border-bottom: 6px solid #266080;
background: #444;
}
.navbar.navbar-custom .navbar-toggle {
z-index: 1;
border: none;
background: none;
}
.navbar.navbar-custom .navbar-collapse {
background: #444;
}
.navbar.navbar-custom .navbar-nav > li {
border-left: 1px solid #fff;
}
.navbar.navbar-custom .navbar-nav > li:last-child {
border-right: 1px solid #fff;
}
.navbar .formSearch {
left: 0;
position: absolute;
}
.navbar .formSearch .has-feedback span.glyphicon {
padding: 7px;
margin-right: 10px;
cursor: pointer;
pointer-events: auto;
color: #fff;
}
.navbar .btn.btn-search,
.navbar .btn.btn-search:hover,
.navbar .btn.btn-search:focus {
background: none;
height: 50px;
box-shadow: none;
outline: none;
border-radius: 0;
border: none;
color: #fff;
}
.navbar #search-input {
height: 50px;
background: #444;
color: #fff;
box-shadow: none;
outline: none;
font-size: 20px;
border: none;
display: none;
}
.navbar #search-input:focus {
height: 50px;
background: #444;
color: #DFE82A;
box-shadow: none;
outline: none;
font-size: 20px;
border: none;
display: none;
}
.navbar .input-group-btn #btn-go {
height: 50px;
border-radius: 0;
border: none;
box-shadow: none;
outline: none;
background: rgba(17, 18, 19, 1) color: #fff;
display: none;
}
.well.well-dark {
background: #444;
border-radius: 0;
color: #fff;
text-align: center;
}
.footer {
bottom: 0;
width: 100%;
height: 100px;
background: #444;
line-height: 85px;
border-top: 6px solid #266080;
border-bottom: 6px solid #266080;
}
ul.footer-nav > li {
list-style: none;
text-align: right;
}
ul.footer-nav > li > a {
text-decoration: none;
color: #fff;
}
/* Media Qs */
@media (min-width: 768px) {
.navbar.navbar-custom .navbar-nav {
width: 100%;
text-align: center;
}
.navbar.navbar-custom .navbar-nav > li {
float: none;
display: inline-block;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-inverse navbar-custom navbar-top">
<section class="banner" id="banner">
<img src="http://scottace.com/img/css3-icon.png">
</section>
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" 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>
<form class="formSearch" role="search"> <span class="input-group"> <span class="input-group-btn">
<button class="btn btn-default btn-search" type="button"><span class="glyphicon glyphicon-search"></span>
</button>
</span>
<div class="has-feedback">
<input type="text" class="form-control hasclear" id="search-input" placeholder="Search for..."> <span class="clearer glyphicon glyphicon-remove form-control-feedback"></span>
</div> <span class="input-group-btn">
<button class="btn btn-default" id="btn-go" type="button"> Search</button>
</span>
</span>
</div>
</form>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="#">Link</a>
</li>
<li><a href="#">Link</a>
</li>
<li><a href="#">Link</a>
</li>
<li><a href="#">Link</a>
</li>
<li><a href="#">Link</a>
</li>
<li><a href="#">Link</a>
</li>
<li><a href="#">Link</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<div class="container">
<div class="well well-lg well-dark">
<h1>Boostrap Search Bar</h1>
</div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It
has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer
took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset
sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries,
but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker
including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled
it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,
and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since
the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in
the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting
industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic
typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem
Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer
took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset
sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries,
but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker
including versions of Lorem Ipsum.</p>
</div>
<footer class="footer">
<div class="container">
<ul class="footer-nav">
<li><a href="#">Copyright © 2015</a>
</li>
</ul>
</div>
</footer>
Не уверен в изображении, я бы не использовал процент для ширины, а затем vh для высоты, поскольку thia может вызвать искажение. Вставьте один и центрируйте его.
Однако ссылки могут использовать процентную ширину контейнера, в котором они находятся, чтобы они заполнили весь экран в соответствии с вашим дизайном.
Хорошо, плохо, попробуйте изменить. Вы знаете, как я могу добавить те бары, которые находятся в дизайне? Те, что находятся в верхней части заголовка, внизу и над содержимым nav – John
Сделайте два div один до и один после вашего изображения и дайте им ширину 100% и высоту, равную 10 пикселей, и сделайте цвет фона красным (или любым другим, что вы хотите) –
Извините один между ссылками один за другим и перед изображением, затем поиграйте с высотой, чтобы получить то, что вы хотите –
- 1. Bootstrap Nav Bar Resize
- 2. Bootstrap Оправданный Nav Bar
- 3. Bootstrap nav bar collapsing
- 4. Bootstrap nav-bar
- 5. Bootstrap Nav Bar Active
- 6. BootStrap Nav Bar issue
- 7. Bootstrap - custom nav-bar
- 8. Bootstrap nav bar внезапно сломался
- 9. Bootstrap Nav Bar Links Border
- 10. Bootstrap nav-bar слишком длинный
- 11. bootstrap nav bar collapse issues
- 12. Bootstrap v3.3.2 Nav Bar Breakpoint
- 13. React bootstrap nav-bar styling
- 14. WindowManager.addView ontop (overlay) программной клавиши OR nav bar
- 15. Изображение в CSS nav bar
- 16. Реализация Bootstrap Nav Bar на собственном сайте
- 17. Bootstrap nav bar с домашним значком проблема
- 18. bootstrap nav-bar collapse icon not triggering
- 19. Bootstrap glyphicon/nav bar, отображающий всплывающее окно
- 20. Bootstrap Nav Bar JQuery Частично исправлено
- 21. Bootstrap mobile nav bar не рушится правильно
- 22. Горизонтально центр поиска bar bootstrap nav
- 23. Bootstrap Scrolling Nav Bar работает неправильно
- 24. Выровнять текст в центре Bootstrap Nav Bar
- 25. Слайд nav bar слева в Bootstrap
- 26. bootstrap nav bar расширяется, когда он обрушивается
- 27. Bootstrap Nav Bar не закрывает на мобильном
- 28. Bootstrap Обоснованно Nav Bar не правильно разбирается
- 29. Bootstrap nav bar drop down element
- 30. Bootstrap 3 Complicated Nav Bar - A Toughie
Могу ли я использовать это, если navbar не был исправлен? Если нет, что мне нужно изменить? – John
Хорошо, мне удалось заставить его работать без исправления! – John
См. Этот ответ также для нефиксированного nav: http://stackoverflow.com/questions/32628502/bootstrap-3-centered-nav-and-image-behind/32643509#32643509 – vanburen