I was building a website where I encountered a problem in navigation bar that the elements of navigation bar is not coming center aligned
HTML and CSS code:
<nav class="navbar navbar-inverse">
<div class="container">
<ul id="navigation" class="nav navbar-nav">
<li class="active"> Home </li>
<li> Marketing Services </li>
<li> IT Management Services </li>
<li> Molex Portfolio </li>
<li> Contact Us </li>
<li> Employement Opportunities </li>
</ul>
</div>
</nav>
My css Code is
body{
background-repeat:no-repeat;
background-position: top right;
background-attachment: fixed;
}
h1{
margin:1px ;
color:red !important;
text-align:center;
}
hr{
border-color:red !important;
width:50%;
}
a {
padding: 0px 10px;
}
#navigation{
text-align:center!important;
display: inline-block!important;
margin: auto;
}
You are trying to center the ul with inline-block style, try to change the it to be block instead
body{
background-repeat:no-repeat;
background-position: top right;
background-attachment: fixed;
}
h1{
margin:1px ;
color:red !important;
text-align:center;
}
hr{
border-color:red !important;
width:50%;
}
a {
padding: 0px 10px;
}
#navigation {
text-align:center!important;
display: block!important;
margin: auto;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-inverse">
<div class="container">
<ul id="navigation" class="nav navbar-nav">
<li class="active"> Home </li>
<li> Marketing Services </li>
<li> IT Management Services </li>
<li> Molex Portfolio </li>
<li> Contact Us </li>
<li> Employement Opportunities </li>
</ul>
</div>
</nav>
Try the below code, Hope this work...!
#media (min-width: 768px){
.navbar-nav {
float: none!important;
margin: 0 auto!important;
display: table!important;
table-layout: fixed!important;
}
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-inverse">
<div class="container">
<ul id="navigation" class="nav navbar-nav">
<li class="active"> Home </li>
<li> Marketing Services </li>
<li> IT Management Services </li>
<li> Molex Portfolio </li>
<li> Contact Us </li>
<li> Employement Opportunities </li>
</ul>
</div>
</nav>
If you want to center align the text in the "li" just do
.navbar navbar-inverse{
ul>li{
text-align: center;
}
}
Related
My goal is to have the navigation buttons jump to the top of each section. I've tried using position: relative; and using top: but it then changes the look of the site at the top, which I don't want. My problem right now is that it doesn't jump to the top of the section. This is because the nav bar is covering the top of each section (except for the last one). But I don't know what to do to solve this issue. I've researched this problem to the best of my ability but couldn't find a relevant post for this. I've cut down the code to what I believe is the minimum.
<div id="container">
<header id="header">
<img id="header-img" src="https://cdn.mos.cms.futurecdn.net/BQwukuZwwwXrg27B9Le2Q6.png"/>
<nav id="nav-bar">
<ul>
<li id="nav-btn">
<a class="nav-link" id="features" href="#Features">Features</a>
</li>
<li id="nav-btn">
<a class="nav-link" id="demo" href="#Demo">Demo</a>
</li>
<li id="nav-btn">
<a class="nav-link" id="pricing" href="#Pricing">Pricing</a>
</li>
</ul>
</nav>
</header>
<img id="cybertruck" src="https://images.hgmsites.net/hug/tesla-cybertruck_100725713_h.jpg"/>
<section id="Features">
<h3>EXOSKELETON</h3>
<h3>ULTRA-HARD 30X COLD-ROLLED STAINLESS STEEL</h3>
<h3>TESLA ARMOR GLASS</h3>
</section>
<section id="Demo">
<iframe id="video" src="https://www.youtube.com/embed/m7atGkba-Z8" allowfullscreen></iframe>
</section>
<section id="Pricing">
<h3>Single-Motor Cybertruck</h3>
<ul>
<li>$39,900</li>
<li>250+ miles of range</li>
<li>0-60 moh in 6.5 seconds</li>
<li>top speed of 110 mph</li>
</ul>
<h3>Dual-Motor Cybertruck</h3>
<ul>
<li>$49,900</li>
<li>300+ miles of range</li>
<li>0-60 moh in 4.5 seconds</li>
<li>top speed of 120 mph</li>
</ul>
<h3>Tri-Motor Cybertruck</h3>
<ul>
<li>$69,900</li>
<li>500+ miles of range</li>
<li>0-60 moh in 2.9 seconds</li>
<li>top speed of 130 mph</li>
</ul>
</section>
</div>
CSS:
header {
display: flex;
position: fixed;
top: 0px;
width: 100%;
background-color: #fcf6f5;
}
#header-img {
height: 80px;
position: relative;
left: 100px;
}
#container {
background-color: #fcf6f5;
}
nav ul {
display: flex;
}
#nav-btn {
position: relative;
left: 500px;
top: 20px;
}
#features, #demo, #pricing {
padding-right: 100px;
}
ul {
list-style-type: none;
}
Add this to your css
#Features, #Demo, #Pricing{
padding-top: 100px;
}
This will set the needed padding so each section can be shown correctly
I would also rename the id's of the a elements on the header to this
<ul>
<li id="nav-btn">
<a class="nav-link" id="features-link" href="#Features">Features</a>
</li>
<li id="nav-btn">
<a class="nav-link" id="demo-link" href="#Demo">Demo</a>
</li>
<li id="nav-btn">
<a class="nav-link" id="pricing-link" href="#Pricing">Pricing</a>
</li>
</ul>
and do the same to the css accordingly
#features-link, #demo-link, #pricing-link{
padding-right: 100px;
}
I'm very new to HTML and CSS. I'm trying to center the navbar at the top of a site. Here is my HTML code:
<!-- Navigation -->
<div class="nav_container">
<nav class="navbar navbar-default navbar-fixed-top top-nav-collapse" role="navigation">
<div class="container">
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav page-scroll" style="text-align:center">
<li>
<a class="page-scroll" href="#page-top">Start</a>
</li>
<li>
<a class="page-scroll" href="#packages">Packages</a>
</li>
<li>
<a class="page-scroll" href="#about">About</a>
</li>
<li>
<a class="page-scroll" href="#showcase">Showcase</a>
</li>
<li>
<a class="page-scroll" href="#portfolio">Portfolio</a>
</li>
<li>
<a class="page-scroll" href="#contact">Contact</a>
</li>
</ul>
</div>
</div>
</nav>
</div>
And here is (some) relevant CSS code:
.navbar {
position: relative;
min-height: 50px;
margin-bottom: 20px;
border: 1px solid transparent;
}
#media (min-width: 768px) {
.navbar {
border-radius: 4px;
}
}
.nav_container {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
position: relative;
opacity: 1;
text-align: center;
}
.nav_container nav {
display: inline-block;
text-align: center;
}
.container {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
I must apologise in advance if this question looks like a duplicate of other questions. I have tried out different permutations of how the CSS code should be set according to other answered questions, but to be honest how and which class in the CSS code takes precedence is still not clear to me and my navbar is just not centering. I took the code from a bootstrap site, and am simply reverse engineering. It could be that what is already written contains some redundant code (for example, there may be too many divs) and so may need to be cleared up.
change :
<div class="nav_container">
<nav class="navbar navbar-default navbar-fixed-top top-nav-collapse" role="navigation">
<div class="container">
To :
<div class="container">
<div class="nav_container">
<nav class="navbar navbar-default navbar-fixed-top top-nav-collapse" role="navigation">
Demo
Note : For See Result increment Result Page.
float: left;
and
display: inline;
are both failing to work.
What am I doing wrong? How can I make this navigation bar horizontal?
.navbar li {
margin: 5px;
padding: 0;
width: 80px;
float: left;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand">Simmo Simpson</a>
</div>
<ul class="nav navbar-nav">
<li id="navbar" class="active">Home</li>
<li id="navbar" class="active">About</li>
<li id="navbar" class="active">Portfolio</li>
<li id="navbar" class="active">Contact</li>
</ul>
</div>
</nav>
put your css inside style tags or an external css file and include it in the header section of your html
<style>
ul li{ display: inline;}
</style>
try the following code snippet, it might help you
.navbar li {
margin: 5px;
padding: 0;
width: 80px;
float: left;
list-style-type : none;
}
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand">Simmo Simpson</a>
</div>
<ul class="nav navbar-nav">
<li id="navbar" class="active">Home</li>
<li id="navbar" class="active">About </li>
<li id="navbar" class="active">Portfolio </li>
<li id="navbar" class="active">Contact </li>
</ul>
</div>
</nav>
<!DOCTYPE html>
<html>
<head>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: #111;
}
</style>
</head>
<body>
<ul>
<li><a class="active" href="#home">Home</a></li>
<li>News</li>
<li>Contact</li>
<li>About</li>
</ul>
</body>
</html>
Changed
.navbar li {
to
li.navbar {
li.navbar {
margin: 5px;
padding: 0;
width: 80px;
float: left;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand">Simmo Simpson</a>
</div>
<ul class="nav navbar-nav">
<li id="navbar" class="active">Home</li>
<li id="navbar" class="active">About</li>
<li id="navbar" class="active">Portfolio</li>
<li id="navbar" class="active">Contact</li>
</ul>
</div>
</nav>
Is this what you are looking for?
Solved:
The
<li id="navbar" class="active">Home</li>
elements need the corresponding CSS to be
#navbar
and NOT
.navbar li
.navbar li should be used in the CSS for the html class attribute class="navbar li" whereas #navbar should be used the ID attribute
When I changed that, the CSS styling was applied to the html with the corresponding id attribute.
It seems you're doing things the right way, but your code sample misses some tags :
<html>
<head>
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand">Simmo Simpson</a>
</div>
<ul class="nav navbar-nav">
<li class="navbar-link" class="active">Home</li>
<li class="navbar-link" class="active">About</li>
<li class="navbar-link" class="active">Portfolio</li>
<li class="navbar-link" class="active">Contact</li>
</ul>
</div>
</nav>
<style>
.navbar li {
margin: 5;
padding: 0;
width: 80;
float: left;
}
</style>
</body>
</html>
will do the trick. You have to say to the browser, what it have to do with those lines : use Html <html> and apply that style using <style> . If your style directives have to be more important, I think that it could be a better way to create a second file that will contains all your css and to link it with your html document.
EDIT :
The css rule : .navbar li will find the navbar class and find all its li childs, so you can remove ids on each li and replace them by a class name
I hope it may help
I have a weird question..
I use bootstrap for the first time and it's very awesome indeed. While coding my test website, I figured out something wrong in the monitor sizing.. and that's:
-I copied the navigation html code directly to new line
-I removed the hamburger icon for the switch toggle -show / dont show- from the second new created icon
-I modified the main content for the current element
-whenever I force small the monitor like alternativly telling the site I open from a small monitor, the second bar's element completely disappear. and since I already deleted the toggle button, I can't activate it nor doing anything but maximizing the size so it appears again.
The thing is, i want it to be completely appeared. No toggle thing, only compressing itself when its previewed from small monitor just like the navigation bar when I click on the hamburger icon
Any thoughts how to do this? Thanks and sorry for my awful annoying question. I know it's very annoying but, I just started learning this language and I may face some things in the process.
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>title</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="css/sidebar.css">
<link rel="stylesheet" href="css/custom.css">
<link rel="stylesheet" media="screen" href="css/style.css">
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div>
<nav class="navbarmain navbar navbar-default mainnav">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<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>
<a class="navbar-brand" href="#">S-Bolb</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active">Feed <span class="sr-only">(current)</span>
</li>
<li class="dropdown">
Pages <span class="caret"></span>
<ul class="dropdown-menu">
<li>Page 1
</li>
<li>Page 2
</li>
<li>Page 3
</li>
<li role="separator" class="divider"></li>
<li>Add Page
</li>
<li>Manage Pages
</li>
</ul>
</li>
<li>Trending
</li>
<li>co.Groups
</li>
<li>Find Friends
</li>
<li>Analytics
</li>
<li>Events
</li>
</ul>
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="search">
</div>
</form>
<ul class="nav navbar-nav navbar-right">
<li>Link
</li>
<li class="dropdown">
Dropdown <span class="caret"></span>
<ul class="dropdown-menu">
<li>Action
</li>
<li>Another action
</li>
<li>Something else here
</li>
<li role="separator" class="divider"></li>
<li>Separated link
</li>
</ul>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<div id="wrapper">
<div class="userpanel">
<!-- Sidebar -->
<div id="sidebar-wrapper">
<ul class="sidebar-nav">
<li>Ahmed T.
</li>
Senior Designer
<br>
View my profile
<br>
<a>1</a>-<a>2</a>-<a>3</a>-<a>4</a>-<a>5</a>
<br>
<li role="separator" class="divider"></li>
Connected Networks
<li>Facebook /username
</li>
<li>Twitter /username
</li>
<li>Instagram /username
</li>
<li>Tumblr /username
</li>
<li>Behance /username
</li>
add more
</ul>
<ul class="sidebar-nav">
<li>Liked Pages
</li>
<li>App Center
</li>
<li>Games Feed
</li>
<li>Customize Profile
</li>
</ul>
<ul class="sidebar-nav">
<li>Social Groups
</li>
<li>Group 1
</li>
<li>Group 2
</li>
<li><a>Lorem ipsum dolor sit amet, consectetur adipisicing elit,</a>
</li>
</ul>
<ul class="sidebar-nav">
<li>My Account
</li>
<li>Settings
</li>
<li>Privacy Policy
</li>
<li>Advertising
</li>
</ul>
<a class="block-button" href="#">Logout</a>
</div>
<!-- feed -->
<div id="page-content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<nav class="usercontrolbar navbar navbar-default">
<div class="container">
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active">view all <span class="sr-only">(current)</span>
</li>
<li class="dropdown">
close friends (3) <span class="caret"></span>
<ul class="dropdown-menu">
<li>Suzan William
</li>
<li>Boza Suman
</li>
<li>Cameron Wheeler
</li>
</ul>
</li>
<li class="dropdown">
custom category (15) <span class="caret"></span>
<ul class="dropdown-menu">
<li>Group
</li>
<li>Group
</li>
<li>Group
</li>
<li>Group
</li>
<li>Group
</li>
<li>Group
</li>
<li>Group
</li>
<li>Group
</li>
<li>Group
</li>
<li>Group
</li>
<li>Group
</li>
<li>Group
</li>
<li>Group
</li>
<li>Group
</li>
<li>Group
</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a style="font-size:22px;">Welcome back, Ahmed! <span class="glyphicon glyphicon-hand-left" id="menu-toggle" aria-hidden="true"></span></a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="js/geometryangle.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<!-- Menu toggle script -->
<script>
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("active");
});
</script>
</body>
</html>
and the sidebar.css:
.row{
margin-right:0px;
margin-right:0px;
}
#wrapper {
transition: all .4s ease 0s;
height: 100%
}
#sidebar-wrapper {
margin-right: -200px;
right: 70px;
width: 150px;
background: #222;
position: fixed;
height: 100%;
z-index: 10000;
transition: all .4s ease 0s;
}
.sidebar-nav {
display: block;
float: right;
width: 150px;
list-style: none;
margin: 0;
padding: 0;
}
#page-content-wrapper {
padding-right: 0;
margin-right: 0;
width: 100%;
height: auto;
}
#wrapper.active {
padding-right: 150px;
}
#wrapper.active #sidebar-wrapper {
right: 150px;
}
#page-content-wrapper {
width: 100%;
}
#sidebar_menu li a, .sidebar-nav li a {
color: #999;
display: block;
float: right;
text-decoration: none;
width: 150px;
background: #252525;
border-top: 1px solid #373737;
border-bottom: 1px solid #1A1A1A;
-webkit-transition: background .5s;
-moz-transition: background .5s;
-o-transition: background .5s;
-ms-transition: background .5s;
transition: background .5s;
}
.sidebar_name {
padding-top: 25px;
color: #fff;
opacity: .7;
}
.sidebar-nav li {
line-height: 40px;
text-indent: 20px;
}
.sidebar-nav li a {
color: #999999;
display: block;
text-decoration: none;
}
.sidebar-nav li a:hover {
color: #fff;
background: rgba(255,255,255,0.2);
text-decoration: none;
}
.sidebar-nav li a:active,
.sidebar-nav li a:focus {
text-decoration: none;
}
.sidebar-nav > .sidebar-brand {
height: 65px;
line-height: 60px;
font-size: 18px;
}
.sidebar-nav > .sidebar-brand a {
color: #999999;
}
.choixMenu{
font-size: 12px;
float: right;
text-align-right;
margin-right: 1px;
}
.sidebar-nav > .sidebar-brand a:hover {
color: #fff;
background: none;
}
#main_icon
{
float:right;
padding-right: 65px;
padding-top:20px;
}
.sub_icon
{
float:right;
padding-right: 65px;
padding-top:10px;
}
.content-header {
height: 65px;
line-height: 65px;
}
.content-header h1 {
margin: 0;
margin-right: 20px;
line-height: 65px;
display: inline-block;
}
#media (max-width:767px) {
#wrapper {
padding-right: 70px;
transition: all .4s ease 0s;
}
#sidebar-wrapper {
right: 70px;
}
#wrapper.active {
padding-right: 150px;
}
#wrapper.active #sidebar-wrapper {
right: 150px;
width: 150px;
transition: all .4s ease 0s;
}
}
The second thing is:
How can I make the border sharp? Whenever I add new rule in CSS for all the layout to be with no border, it doesn't work, why is it soft from the edges and not completely 90 degree?
Answer to the second question:
To make the corners of your navbar you need to add the .navbar-static-top class like so:
<div class="navbar navbar-default navbar-static-top">
<!-- enter code here -->
</div>
I would suggest reinstalling the css file to get the toggle functions back.
Once you have that, within the Bootstrap CSS file, you can change when the Toggle function activates, this gives you the option to call the toggle on a certain screen-size.
secondquestion, you can either set the navbar-default/inverse to navbar-static-top, or if you want it to stick to the top, change the CSS to border-radius:0px !important
Hope this helps
Please hvae a look at the below code
<div id="main-sidebar-wrapper" style="margin-top:50px; width:150px;">
<ul class="sidebar-nav" style="margin-top:10px;">
<!-- <li> Face Sheet </li> -->
<li class="li_active"> History </li>
<li> Problems </li>
<li> Medications </li>
<!-- <li> Immunizations </li> -->
<li > Allergies </li>
<li> Vitals </li>
<li> Examinations </li>
<li > Counseling </li>
<li> Demographics </li>
<hr>
<li>Documents Upload
<ul class="sub-menu">
<li>E.C.G</li>
</ul>
</li>
<!-- <li> Documents </li> -->
</ul>
</div>
Here, the Documents Upload section, I want it to be a drop-up menu or drop-right side menu. How can I do this?
#media (min-width: 768px) {
.navbar-collapse {
height: auto;
border-top: 0;
box-shadow: none;
max-height: none;
padding-left:0;
padding-right:0;
}
.navbar-collapse.collapse {
display: block !important;
width: auto !important;
padding-bottom: 0;
overflow: visible !important;
}
.navbar-collapse.in {
overflow-x: visible;
}
.navbar
{
max-width:300px;
margin-right: 0;
margin-left: 0;
}
.navbar-nav,
.navbar-nav > li,
.navbar-left,
.navbar-right,
.navbar-header
{float:none !important;}
.navbar-right .dropdown-menu {left:0;right:auto;}
.navbar-collapse .navbar-nav.navbar-right:last-child {
margin-right: 0;
}
}
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- Jquery CDN -->
<script src="https://code.jquery.com/jquery-2.1.2.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<nav class="navbar navbar-default" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<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="#">Brand</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li class="active">Link</li>
<li>Link</li>
<li class="dropdown">
Dropdown <b class="caret"></b>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something else here</li>
<li>Separated link</li>
<li>One more separated link</li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div><!-- /.navbar-collapse -->
</nav>
Please find updated fiddle.
Need to do some change in
<li>Documents Upload
<ul class="sub-menu">
<li>E.C.G</li>
</ul>
</li>
I have made required changes. Please go through the link.
This is similar to how the dropdown menus work on mobile, may help.
body,
html {
height: 100%;
}
.sidebar-fixed {
padding: 5px 18px;
position: fixed;
width: 175px;
height: 100%;
top: 0;
left: 0;
background: #f5f5f5;
}
.sidebar-fixed #drop-one {
list-style: none;
text-align: left;
}
.sidebar-fixed #drop-one > li {
padding-top: 10px;
font-size: 13px;
}
.sidebar-fixed #drop-one > li >a {
color: #555;
text-decoration: none;
}
ul.sidebar-list {
list-style: none;
display: inline;
text-align: left;
}
ul.sidebar-list > li {
font-size: 18px;
padding-bottom: 25px;
}
ul.sidebar-list > li > a {
color: #555;
text-decoration: none;
}
.main-content {
margin-left: 175px;
padding-top: 5px;
}
<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="sidebar-fixed" id="sideNavParent">
<ul class="sidebar-list">
<li> Sidebar
</li>
<li> Something
</li>
<li> Something <span class="caret"></span>
<ul id="drop-one" class="collapse" data-parent="#sideNavParent">
<li> Something
</li>
<li> Something
</li>
<li> Something
</li>
<li> Something
</li>
</ul>
</li>
</ul>
</div>
<div class="main-content">
<div class="container-fluid">
<div class="alert alert-info">Main Content</div>
</div>
</div>