HTML, Bootstrap 3: curved bottom brand navbar - html

I want to make a NavBar using Bootstrap 3 that looks like this:
However, I'm can't seem to get the rounded brand logo in the center, heres the current result:
The codes for my current navbar is like so:
<div class="container">
<div class="nav-color">
<div class="nav-wrap">
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><span class="hidden-xs"></span><span class="text">Insert Image</span></li>
<li class=""><span class="hidden-xs"></span><span class="text">Insert Image</li>
<li class="logo hidden-xs"><img alt="Insert Image Logo" src=""></li>
<li class=""><span class="hidden-xs"></span><span class="text">Insert Image</span></li>
<li class=""><span class="hidden-xs"></span><span class="text">Insert Image</span></li>
</ul>
</div>
</div>
</nav>
</div>
</div>
</div>
I'm not sure how i can round the bottom of the logo brand while not pushing the entire section down leaving a white space in between.

only add some css, click run and see full page to see if this is what you want, and if it is, you need to override the style of menu hover too
.logo {
width: 120px;
height: 50px;
}
.logo a {
height: 90px;
background: yellow;
border-radius: 0 0 40px 40px;
}
.logo img {
background: green;
width: 60px;
height: 60px;
margin: 0 15px;
border-radius: 100%;
display: block;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="nav-color">
<div class="nav-wrap">
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><span class="hidden-xs"></span><span class="text">Insert Image</span></li>
<li class=""><span class="hidden-xs"></span><span class="text">Insert Image</li>
<li class="logo hidden-xs">
<img alt="Insert Image Logo" src="">
</li>
<li class=""><span class="hidden-xs"></span><span class="text">Insert Image</span></li>
<li class=""><span class="hidden-xs"></span><span class="text">Insert Image</span></li>
</ul>
</div>
</div>
</nav>
</div>
</div>
</div>

Related

Not able to add full height to sidebar

I am trying to create a navbar and a sidebar by bootstrap. I have used one row for the navbar and another row for sidebar and content in different columns each. I need my navbar which is in my first column, to expand to the end.
Here is my CSS
.sidebar-col{
background-color: #2c3236;
height: 100% !important;
}
.nopadding{
padding: 0 !important;
}
.sidebar-head{
color: #73ffff;
font-size: 18px;
padding-top: 40px;
margin-left: 15px;
}
.sidebar-un-list{
margin-top: 20px;
padding: 5px;
}
.sidebar-un-list a{
color: antiquewhite;
text-decoration: none;
}
.sidebar-un-list a:hover{
color: rgb(58, 186, 218);
text-decoration: none;
}
.sidebar-list{
padding: 10px;
}
.sub-list{
padding: 10px;
margin-left: 5px;
}
.sub-list a:hover{
color: #73ffff;
}
JSBin for my website.
you can just define sidebar to be full height with little css, exactly with this:
.sidebar-row{
min-height: calc(100vh - 56px);
}
(this 56px is the current header height) .. see example below:
.sidebar-row{
min-height: calc(100vh - 56px);
}
.sidebar-row > *{
border: 1px solid red
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.1/css/bootstrap.min.css" integrity="sha384-VCmXjywReHh4PwowAiWNagnWcLhlEJLA5buUprzK8rxFgeH0kww/aWY76TfkUoSX" crossorigin="anonymous">
<div class="container-fluid">
<!-- header navbar -->
<header class="row">
<div class="col-md-12 nopadding">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
COMPANY NAME
<button class="navbar-toggler" data-toggle="collapse" data-target="#navbarMenu">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarMenu">
<ul class="navbar-nav ml-auto">
<li class="nav-item">Login</li>
<li class="nav-item">Home</li>
</ul>
</div>
</nav>
</div>
</header>
<!-- sidebar section -->
<section class="row sidebar-row justify-content-start align-items-stretch">
<div class="col-md-2 sidebar-col nopadding">
<!-- <div class="wrapper h-100 my-wrapper"> -->
<nav id="sidebar">
<div class="sidebar-header">
<h6 class="sidebar-head">Functionalities</h6>
</div>
<ul class="list-unstyled components navbar-nav sidebar-un-list">
<li class="active nav-item sidebar-list">
Home
<ul class="collapse list-unstyled" id="homeSubmenu">
<li class="sub-list">
Home1
</li>
<li class="sub-list">
Home2
</li>
<li class="sub-list">
Home3
</li>
</ul>
</li>
<li class="nav-item sidebar-list">
About
</li>
<li class="nav-item sidebar-list">
Contact
</li>
<li class="nav-item sidebar-list">
Help
</li>
<li class="active nav-item sidebar-list">
Home
<ul class="collapse list-unstyled" id="homeSubmenu2">
<li class="sub-list">
Home1
</li>
<li class="sub-list">
Home2
</li>
<li class="sub-list">
Home3
</li>
</ul>
</li>
</ul>
</nav>
<!-- </div> -->
</div>
<div class="col-md-10">
Hello
</div>
</section>
</div>
<!-- container-fluid ends -->

I am not able to navigate to div element from anchor tag with navigation bar of bootstrap

I am trying to navigate to div element from href.
It works fine but when i am adding the href in navigation bar of bootstrap it is not working.
If i remove the navigation bar then it works fine.
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header"> <a class="btn responsive-menu" data-toggle="collapse" data-target=".navbar-collapse"><i></i></a>
<div class="navbar-brand text-center"> <img width="114" height="64" src="style/images/logo.png" alt="" data-src="style/images/logo1.png" data-ret="style/images/logo#2x.png" class="retina" /> </div>
<!-- /.navbar-brand -->
</div>
<!-- /.navbar-header -->
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="current">Home</li>
<li>Portfolio</li>
<li>About</li>
<li>Contact</li>
<li>Blog</li>
<li>Elements</li>
<li><i class="icon-heart-1"></i><span>Elsewhere</span></li>
</ul>
<!-- /.navbar-nav -->
</div>
</nav>
It does not work when i add the nav bar.
It's probably something else. look here:
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header"> <a class="btn responsive-menu" data-toggle="collapse" data-target=".navbar-collapse"><i></i></a>
<div class="navbar-brand text-center"> <img width="114" height="64" src="style/images/logo.png" alt="" data-src="style/images/logo1.png" data-ret="style/images/logo#2x.png" class="retina" /> </div>
<!-- /.navbar-brand -->
</div>
<!-- /.navbar-header -->
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="current">Home</li>
<li>Portfolio</li>
<li>About</li>
<li>Contact</li>
<li>Blog</li>
<li>Elements</li>
<li><i class="icon-heart-1"></i><span>Elsewhere</span></li>
</ul>
<!-- /.navbar-nav -->
</div>
</nav>
<div id="portfolio" style="margin-top: 100vh; background: blue; color: white; height: 100vh;">PORTFOLIO</div>
<div id="about" style="margin-top: 100vh; background: black; color: white; height: 100vh;">ABOUT</div>
<div id="contact" style="margin-top: 100vh; background: green; color: white; height: 100vh;">CONTACT</div>
<div id="elsewhere" style="margin-top: 100vh; background: red; color: white; height: 100vh;">ESLEWHERE</div>

Navbar element drops to second line instead of aligning to the right

Using Bootstrap to create a menu bar. My brand label is aligned far left. The main menu options are center aligned. I'm trying to get 'Logout' to be right aligned. But instead, its on a second line and centered.
<style>
body {
background-color: White;
margin-left: 40px;
margin-right: 40px;
}
.navbar .navbar-nav {
display: inline-block;
float: none;
vertical-align: top;
}
.navbar .navbar-collapse {
text-align: center;
}
.navbar .navbar-right {
text-align: right;
display: inline-block;
float: none;
vertical-align: top;
}
</style>
<body id=<?php echo $bodyid ?>>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="navbar-header">
<a class="navbar-brand">Assessment Manager</a>
</div>
<div class="collapse navbar-collapse">
<div class="container">
<ul class="nav navbar-nav">
<li>Home</li>
<li>Clients</li>
<li>Contacts</li>
<li>Employees</li>
<li>Findings</li>
<li>Projects</li>
<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Vulnerabilities<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>Host</li>
<li>Web</li>
</ul>
</li>
</ul>
</div>
<div class="container">
<ul class="nav navbar-nav">
<li>
<span class="glyphicon glyphicon-log-out"></span> Logout
</li>
</ul>
</div>
</div>
See a picture of the menu bar here.
Put your <ul> elements in the same container. Also you have a CSS class navbar-right that wasn't used in your HTML. This HTML seems to work fine given a wide enough browser window:
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="navbar-header">
<a class="navbar-brand">Assessment Manager</a>
</div>
<div class="collapse navbar-collapse">
<div class="container">
<ul class="nav navbar-nav">
<li>Home</li>
<li>Clients</li>
<li>Contacts</li>
<li>Employees</li>
<li>Findings</li>
<li>Projects</li>
<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Vulnerabilities<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>Host</li>
<li>Web</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<span class="glyphicon glyphicon-log-out"></span> Logout
</li>
</ul>
</div>
</div>
</div>
You could also experiment with float:right; on the <ul> for your login link (using the same navbar-right class.
Also, keep in mind that bootstrap intends for the container class to have row and col classes inside it to further wrap the content. By using only container you're missing out on a lot of the responsive behavior bootstrap is intended to provide.

Insert image at right of dropdown on Boostrap

I'm using Bootstrap to create a navbar in the top of the page, but i'm facing some problems:
After opening the navbar dropdown, I need to have a option list, and a image positioned to the right of the list. This image needs to have the same height of the list, just like in the following image (in portuguese, but easily understandable).
I achieved this setting a fixed height and width on the image, but the list can grow up and isn't a good option adjust it manually.
Another solution is to insert a div containing the list and the image, and set the image size to 100%, but when I do this, the dropdown isn't achieved anymore (I think i'm breaking the structure that Bootstrap uses to toggle the dropdown, am I right?).
How can I achieve this solution?
<div id="navbar" class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav top-elements">
<li id="dropdown-produtos" class="dropdown">
Nossos Produtos<span class="caret top-caret"></span>
<!-- div was here --> <ul class="dropdown-menu dropdown-menu-produtos">
<li class="dropdown-item-active">
texto1
<ul class="dropdown-menu img-dropdown">
<img src="assets/img.png">
</ul>
</li>
<li class="dropdown-item">
texto2
</li>
<li class="dropdown-item">texto3</li>
<li class="dropdown-item">texto4</li>
<li class="dropdown-item">texto5</li>
</ul>
</li>
</ul>
</div>
This should work:
<ul class="nav navbar-nav">
<li>Elemento 1</li>
<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#">DropDown<span class="caret"></span></a>
<ul class="dropdown-menu another-class">
<!-- ROW -->
<div class="col-md-12">
<!-- Column 1 -->
<div class="col-md-6">
<ul class="list-unstyled">
<li>Texto 1</li>
<li>Texto 2</li>
<li>Texto 3</li>
</ul>
</div>
<!-- Column 2 -->
<div class="col-md-6">
<div class="drop-image">
<img src="./img/img.jpg" class="img-responsive" />
</div>
</div>
</div>
</ul>
</li>
<li>Elemento 2</li>
<li>Elemento 3</li>
</ul>
Basically what I'm doing is create a div with a full width inside the dropdown element that comes as default in Boostrap. Inside this Full width row I create two columns with bootstrap col-md-6 class (you can do this with col-lg or col-sm or col-xs too) Inside this columns I add my content normally.
I created a class in the column 2 named "drop-image"; use this class to modify the img inside.
Hope it helps!
Btw, don't forget to style your dropdown (in the example I mark it with a class named another-class) so you define the position and width.
This might solve your problem, it's based off this plugin Yamm3!. See example Snippet.
Change this CSS rule if you need to make the dropdown wider because of the length of the link text. >
.list-unstyled, .list-unstyled ul {
min-width: 180px
}
body {
padding-top: 60px;
color: #666;
}
/* menu styes */
.list-unstyled,
.list-unstyled ul {
min-width: 180px
}
.list-unstyled > li {
padding-top: 10px;
}
.list-unstyled > li > a {
color: #555;
text-decoration: none;
}
.yamm .nav,
.yamm .collapse,
.yamm .dropup,
.yamm .dropdown {
position: static;
}
.yamm .container {
position: relative;
}
.yamm .dropdown-menu {
left: auto;
background: #f5f5f5;
}
.yamm .yamm-content {
padding: 0 30px 10px 30px;
}
.yamm .yamm-content .nav-title {
margin-left: 15px;
}
.yamm .dropdown.yamm-fw .dropdown-menu {
left: 0;
right: 0;
}
#media (max-width: 767px) {
.yamm-content .list-unstyled > li img {
margin-top: -180px;
float: right;
}
}
<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" />
<div class="navbar yamm navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" data-toggle="collapse" data-target="#navbar-collapse-1" class="navbar-toggle"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
</button>Grande Menu
</div>
<div id="navbar-collapse-1" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<!-- Classic list -->
<li class="dropdown">Nossos Produtos<b class="caret"></b>
<ul class="dropdown-menu">
<li>
<!-- Content container to add padding -->
<div class="yamm-content">
<div class="row">
<h4 class="nav-title"><strong>A partida de um</strong></h4>
<ul class="col-sm-4 list-unstyled">
<li>Vinculando um
</li>
<li>Ligando dois
</li>
<li>Ligação de três
</li>
<li>Quatro ligação
</li>
<li>Ligação cinco
</li>
<li>Seis ligação
</li>
</ul>
<ul class="col-sm-2 list-unstyled">
<li>
<img src="http://placehold.it/150x150/ff0/fff">
</li>
</ul>
</div>
</div>
</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav">
<!-- Classic list -->
<li class="dropdown">Nossos Produtos Dois<b class="caret"></b>
<ul class="dropdown-menu">
<li>
<!-- Content container to add padding -->
<div class="yamm-content">
<div class="row">
<h4 class="nav-title"><strong>A partida de um</strong></h4>
<ul class="col-sm-4 list-unstyled">
<li>Vinculando um
</li>
<li>Ligando dois
</li>
<li>Ligação de três
</li>
<li>Quatro ligação
</li>
<li>Ligação cinco
</li>
<li>Seis ligação
</li>
</ul>
<ul class="col-sm-2 list-unstyled">
<li>
<img src="http://placehold.it/150x150/ff0/fff">
</li>
</ul>
</div>
</div>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="alert alert-warning">Olá</div>
</div>

How to put height 100% at the links of a navbar?

I'm using twitter-bootstrap, and I have the following code to generate an navbar with an avatar in a dropdown:
Check this fiddle: http://jsfiddle.net/X4drb/embedded/result/
HTML
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"> <i class="fa fa-bars"></i>
</button> <a class="navbar-brand" href="index.html"><img src="http://placehold.it/30x30&text=logo" ></a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active">Hello
</li>
<li>Stack
</li>
<li>Overflow
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown"> <img id="avatar" class="img-circle mr1" src="http://placehold.it/30x30&text=photo" > John Doe <b class="caret"></b>
<ul class="dropdown-menu">
<li>Settings
</li>
<li>Logout
</li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
CSS
.caret {
margin-left: 5px;
}
#avatar, .navbar-brand {
margin-right: 5px
}
.navbar-nav {
height: 100%;
margin: 0;
padding 0;
}
But, as you see, the list of the links with Hello, Stack and Overflow doesn't reach the end of the navbar:
Do you have any idea to fix it? I tried putting height: 100%; padding: 0; margin: 0 to the list items of the links, but nothing changes.
Try line-height?
ul.nav.navbar-nav li a:link {
line-height: 32px;
}
http://jsfiddle.net/X4drb/9/
Your ul is not getting proper height. Give the height of ul same as outer div.