I recently started to play round with Bootstrap and I created my logo to go on the top left of the page, and then the nav bar to go on the same line but on the right hand side, and then I wanted to say in the middle of the screen: "Welcome blablah"
However, the welcome bit appears on the top part of the screen, rather then the middle, so it's overlapping the logo for some reason.
Not sure why this is doing this, guessing some bad coding etc.
body {
font-family: 'Open Sans', sans-serif, Arial;
font-size: 16px;
color: #6D6D6D;
background-color: #F5F5F5;
font-weight: 300;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: 'Montserrat', sans-serif, Arial;
padding-bottom: 5px;
color: #373432;
line-height: 1em;
font-weight: normal;
}
a {
text-decoration: none;
outline: none;
}
.parallax {
background-image: url("../Images/back1.jpg");
min-height: 1000px;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
width: 100%;
}
.logo {
float: left;
padding-top: 50px;
padding-left: 40px;
}
.logo h1 {
text-transform: uppercase;
font-weight: 900;
font-size: 60px;
letter-spacing: -5px;
line-height: 50px;
color: white;
}
.navbar-nav>li>a {
line-height: 6px;
}
.navbar {
float: right;
padding-top: 53px;
padding-right: 60px;
font-size: 13px;
text-transform: uppercase;
}
.navbar-default {
background-color: transparent;
border-top: 0px solid rgba(0, 0, 0, 0.5);
border-bottom: 0px solid rgba(0, 0, 0, 0.5);
border-left: 0px solid rgba(0, 0, 0, 0.5);
border-right: 0px solid rgba(0, 0, 0, 0.5);
}
.navbar-default .navbar-nav>li>a {
color: #ffffff;
}
.navbar-default .navbar-nav>li>a:hover,
.navbar-default .navbar-nav>li>a:focus {
background-color: #F8BD23;
text-decoration: none;
color: #ffffff;
-webkit-transition: background-color 200ms linear;
-moz-transition: background-color 200ms linear;
-o-transition: background-color 200ms linear;
-ms-transition: background-color 200ms linear;
transition: background-color 200ms linear;
}
.navbar-nav>li {
padding-left: 30px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="parallax">
<div class="logo"><img src="http://placehold.it/50x50"></div>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button aria-controls="navbar" aria-expanded="false" class="navbar-toggle collapsed" data-target="#navbar" data-toggle="collapse" type="button"><span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span></button>
</div>
<div class="navbar-collapse collapse" id="navbar">
<ul class="nav navbar-nav">
<li>
Home
</li>
<li>
a
</li>
<li>
b
</li>
<li>
c Us
</li>
<li>
d
</li>
<li>
e
</li>
<li>
f
</li>
<li class="dropdown">
<a aria-expanded="false" aria-haspopup="true" class="dropdown-toggle" data-toggle="dropdown" href="#" role="button">Classes</a>
<ul class="dropdown-menu">
<li>
a
</li>
<li>
b
</li>
<li>
c
</li>
<li>
d
</li>
<li>
We
</li>
<li>
r
</li>
<li>
a
</li>
</ul>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
<!--/.container-fluid -->
</nav>
<div class="container">
<div class="HomeMes">
<h1>WELCOME</h1>
</div>
</div>
</div>
The way I could "fix" it is do margin-top: 200px; on the HomeMes class but I know this is bad coding, so I'm trying to find the right way of doing it. If anyone could let me know what I have done wrong that would be excellent. Thanks.
So it should look like this :
Logo Navbar
Welcome message
There you go sir, change your container class to this :
.container {
width:100%;
height:100%;
display:flex;
justify-content:center;
flex-direction: column;
align-items: center;
}
Tested it in chrome and it works, but for some reason it doesn't work in code snippet preview. Hope this helps you. Display:flex helps a lot when trying to horizontally+vertically align elements!
Related
I'm making this Bootstrap 5 navbar, which should collapse at md breakpoint. After the collapse, it should show navlinks in two columns.
When I hit the breakpoint, my navbar is expanded and toggle button doesn't work.
It changes, when I switch off the display: flex property for the navbar - the collapse function works, but my ul's (in which I group li's) are in one column.
How can I reach my goal here - navbar with six elements collapses at md breakpoint and breaks the links into two columns?
<nav class="navbar navbar-expand-md navbar-light sticky-top w-100">
<div class="container-fluid">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainNavbar"
aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="mainNavbar">
<ul class="navUl navbar-nav">
<li class="nav-item">
<a class="nav-link text-nowrap" aria-current="page" href="/aboutMe">o mnie</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button"
data-bs-toggle="dropdown" aria-expanded="false">portfolio</a>
</li>
<li class="nav-item">
<a class="nav-link text-nowrap" href="/beforePS">przed sesją</a>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link navbar-brand" href="/">
<img src="/images/logoKP-trans.png" class="img-fluid" alt="Karolina_photography_logo" id="logo">
</a>
</li>
</ul>
<ul class="navUl navbar-nav">
<li class="nav-item">
<a class="nav-link" href="/voucher">vouchery</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/pricing">pakiety</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/contact">kontakt</a>
</li>
</ul>
</div>
css (very messy, to be optimised):
body {
background-color: #f8edeb;
margin: 0;
font-family: "Quicksand", sans-serif;
font-weight: 400;
opacity: 0;
animation: fadeIn 0.5s;
transition: opacity 0.5s;
}
main {
align-items: center;
margin: 3% 20%;
max-width: 80%;
}
.navbar,
.footer {
background-color: #fae1dd;
color: rgba(0, 0, 0, 0.5);
box-shadow: 10px 5px 5px rgba(202, 178, 174, 0.5);
padding-top: 0;
text-align: center;
}
#mainNavbar {
display: flex;
justify-content: center;
align-items:flex-end;
}
.navbar-brand {
margin: 0;
}
.nav-item {
display: flex;
margin: 0 0.8em;
font-size: 1.2rem;
}
.navUl {
padding-bottom: 10px;
}
.navbar-brand {
max-width: 300px;
height: auto;
padding-bottom: 0;
top: 0.4rem;
}
#mainNavbar a:hover,
#socialIcons a:hover,
.loginButton a:hover {
color: white;
text-shadow: 5px 5px 10px white;
-moz-transition: all 0.2s ease-in;
-o-transition: all 0.2s ease-in;
-webkit-transition: all 0.2s ease-in;
transition: all 0.2s ease-in;
}
.dropdown-menu {
border-radius: 0.5rem;
background-color: rgba(250, 225, 221, 0.9);
}
.dropdown-item:hover {
background-color: transparent;
}
#socialIcons {
color: rgba(0, 0, 0, 0.5);
position: absolute;
top: 10px;
right: 10px;
}
#socialIcons a,
#kidsPshoot {
text-decoration: none;
color: rgba(0, 0, 0, 0.5);
display: inline;
margin-right: 0.5rem;
}
.fade_rule {
height: 1px;
background-color: #e6e6e6;
width: 50%;
margin: 0 auto;
background-image: linear-gradient(left, white 2%, #e6e6e6 50%, white 98%);
background-image: -o-linear-gradient(left, white 2%, #e6e6e6 50%, white 98%);
background-image: -moz-linear-gradient(
left,
white 2%,
#e6e6e6 50%,
white 98%
);
background-image: -webkit-linear-gradient(
left,
white 2%,
#e6e6e6 50%,
white 98%
);
background-image: -ms-linear-gradient(left, white 2%, #e6e6e6 50%, white 98%);
background-image: -webkit-gradient(
linear,
left bottom,
right bottom,
color-stop(0.02, white),
color-stop(0.5, rgb(250, 182, 170)),
color-stop(0.98, white)
);
}
#media (max-width:1200px) {
.nav-item, .dropdown-item, #aboutMeText, p, li, h5 {
font-size: 1rem;
}
#logo {
max-width: 230px;
}
.navUl {
padding-bottom: 5px;
}
}
#media (max-width:992px) {
#logo {
max-width: 200px;
/* position: absolute;
left: 70%;
top: 30%; */
}
.nav-item, .dropdown-item {
font-size: 0.9rem;
}
.nav-item {
margin: 0;
}
}
#media (max-width:768px) {
.nav-item, .dropdown-item, #navbarDropdownMenuLink, p, li {
font-size: 0.7rem;
margin-left: 0;
text-align: left;
min-width: 100px;
}
#mainNav {
position:unset;
}
}
It’s not clear what all of your CSS is for. Some, like setting the opacity on the body to 0 hide everything. It’s best to have a running snippet with your question.
If you want your logo in the center, you can split your menus into two unordered lists.
For applying margin such as to the bottom of the navbar-nav, use the Bootstrap spacing utility classes (mb-1 mb-md-2).
Copy the Bootstrap media query logic (min-width, not max-width – it’s difficult to troubleshoot with two methods) and apply your media queries starting with the smallest size (no media query), followed by increasing media query sizes (min-width: 576px, min-width: 768px, etc.).
Rather than using smaller text for smaller screens, keep the text the same size and adjust the position if the text won’t fit (smaller text is more difficult for some users to read).
One way to have two columns for the links in the collapsed version is to add a spacer div (.break) that can force the navbar-collapse divs to the next row, and then set their width to 50%.
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.1/dist/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://fonts.googleapis.com/css2?family=Quicksand&display=swap" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.1/dist/js/bootstrap.bundle.min.js"></script>
<style>
body {
background-color: #f8edeb;
font-family: "Quicksand", sans-serif;
}
.navbar,
.footer {
background-color: #fae1dd;
color: rgba(0, 0, 0, 0.5);
box-shadow: 10px 5px 5px rgba(202, 178, 174, 0.5);
padding-top: 0;
}
.navbar-brand {
margin: 0;
max-width: 300px;
height: auto;
padding-bottom: 0;
top: 0.4rem;
}
#mainNavbar a:hover,
#socialIcons a:hover,
.loginButton a:hover {
color: white;
text-shadow: 5px 5px 10px white;
-moz-transition: all 0.2s ease-in;
-o-transition: all 0.2s ease-in;
-webkit-transition: all 0.2s ease-in;
transition: all 0.2s ease-in;
}
.dropdown-menu {
border-radius: 0.5rem;
background-color: rgba(250, 225, 221, 0.9);
max-width: 75%;
}
.dropdown-item:hover {
background-color: #E0C9C5;
}
#logo {
max-width: 120px;
height: auto;
}
#media (min-width: 576px) {
#logo {
max-width: 160px;
}
}
#media (min-width: 768px) {
#logo {
max-width: 200px;
}
.navbar-collapse.flex-basis-md-0 {
flex-basis: 0;
}
}
#media (min-width: 992px) {
#logo {
max-width: 230px;
}
}
#media (min-width: 1200px) {
#logo {
max-width: 300px;
}
}
.navbar-collapse {
max-width: 50%;
}
/* Inserting div.break between two flex items will make
* the flex item that comes after it break to a new row -
* this is how the two-column navbar-collapse are moved to
* a separate row. */
.break {
flex-basis: 100%;
height: 0;
}
#media (min-width: 768px) {
.break {
display: none;
}
}
</style>
<nav class="navbar navbar-expand-md navbar-light sticky-top w-100">
<div class="container-fluid justify-content-md-around">
<a class="navbar-brand order-md-1" href="#">
<img id="logo" src="https://via.placeholder.com/120x40.png/E5FFFF/?text=KP-Trans" alt="" width="300" height="60">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".mainNavbar" aria-controls="mainNavbar1 mainNavbar2" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="break"></div>
<div class="collapse navbar-collapse flex-basis-md-0 mainNavbar" id="mainNavbar1">
<ul class="navbar-nav mx-md-auto">
<li class="nav-item">
<a class="nav-link text-nowrap" aria-current="page" href="/aboutMe">o mnie</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
portfolio
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" href="#">portfolio #1</a></li>
<li><a class="dropdown-item" href="#">portfolio #2</a></li>
<li><a class="dropdown-item" href="#">portfolio #3</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link text-nowrap" href="/beforePS">przed sesją</a>
</li>
</ul>
</div>
<div class="collapse navbar-collapse flex-basis-md-0 align-self-start align-self-md-center mainNavbar order-md-2" id="mainNavbar2">
<ul class="navbar-nav mx-md-auto">
<li class="nav-item">
<a class="nav-link" href="/voucher">vouchery</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/pricing">pakiety</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/contact">kontakt</a>
</li>
</ul>
</div>
</div>
</nav>
<section>
<div class="container">
<div class="row">
<div class="col vh-100">
<p class="text-center">
Center
</p>
</div>
</div>
</div>
</section>
It's also helpful if you include a placeholder image at the right size to match your logo. I guessed at 120 by 40
I'm build a SPA app with Angular-CLI and Node.Js, using WebStorm, and I can't figure out why my navbar won't collapse.
When the page is small enough, the nav-items simply disappear.
I'm not using the navbar-expand class (instead using the navbar-expand-sm which isn't supposed to prevent collapsing), and other than that, I found nothing that's supposed to cause this problem.
My navbar.component.html:
<nav class="navbar navbar-expand-sm navbar-brown fixed-top">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="navbar-nav mx-auto">
<li class="nav-item">
<a class="nav-link" (click)="clickedHome()">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" (click)="clickedForums()">Forums</a>
</li>
<li class="nav-item">
<a class="nav-link" (click)="clickedMyZone()">MyZone</a>
</li>
</ul>
</div>
</nav>
<div class="jumbotron text-center" id="primary_jumbotron_display">
<div id="primaryDisplayBorder">
<div id="primaryDisplayContent">{{primaryDisplayBorderTitle}}</div>
<p>{{primaryDisplayBorderContent}}</p>
</div>
</div>
My navbar.component.css:
#import url(//db.onlinewebfonts.com/c/460e8698563db983434874f8f371a7d1?family=Museo);
.jumbotron {
height: 40vh;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
#primary_jumbotron_display {
background-image: url('client/assets/images/FriendLancer_banner.jpg');
font-family: Museo;
font-size: x-large;
background-size: cover;
align-content: center;
color: saddlebrown;
margin-bottom: 0;
}
#primaryDisplayContent {
font-size: 7ex;
}
.navbar-brown {
background-color: saddlebrown !important;
box-shadow: #222222;
}
.navbar {
-webkit-box-shadow: 0 8px 6px -6px black;
-moz-box-shadow: 0 8px 6px -6px black;
box-shadow: 0 8px 6px -6px black;
}
.navbar-nav {
font-family: Museo;
font-size: medium;
}
.navbar-nav > li {
padding-left: 15px;
padding-right: 15px;
}
.nav-item {
transition: all 0.3s ease;
}
.navbar-nav a {
color: silver;
}
.navbar-nav a:hover {
color: saddlebrown;
letter-spacing: 1.3px;
background-image: linear-gradient(to right, sandybrown, rosybrown);
}
Any help would be appreciated.
I am having difficulty getting the logo image (red) to overflow the menu bar, currently the menu bar is extended once the logo is added (see the image).
The HTML Code:
<div id="page" class="page">
<div class="pixfort_normal_1" id="section_header_2_dark">
<div class="header_nav_1 dark pix_builder_bg" style="background-image: none; background-color: rgb(13, 52, 64); padding-top: 0px; padding-bottom: 0px; box-shadow: none; border-color: rgb(255, 255, 255); background-size: auto; background-attachment: scroll; background-repeat: repeat;">
<div class="container">
<div class="sixteen columns firas2">
<nav role="navigation" class="navbar navbar-white navbar-embossed navbar-lg pix_nav_1">
<div class="containerss">
<div class="navbar-header">
<button data-target="#navbar-collapse-02" data-toggle="collapse" class="navbar-toggle pix_text" type="button">
<span class="sr-only ">Toggle navigation</span>
</button>
<img src="images/LOGO1.png" class="pix_nav_logo">
</div>
<div id="navbar-collapse-02" class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active propClone">Home</li>
<li class="propClone">About</li>
<li class="propClone">Workshops and Training</li>
<li class="propClone">Contact</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container -->
</nav>
</div>
</div><!-- container -->
</div>
</div>
The CSS Code:
.pix_nav_1 ul li a {
color: rgba(0, 0, 0, 0.5);
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-ms-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
};
.pix_nav_1 ul li a:hover {
//color: rgba(0,0,0,0.85);
opacity: 0.6;
}
.header_nav_1 {
padding: 0px !important;
box-shadow: none;
}
.pix_nav_logo {
background: url(../images/t_logo.png) no-repeat;
padding-top: 0px;
overflow: visible;
}
.navbar-center {margin-left: auto;margin-right: auto;float: none;position:
relative;text-align: center; }
.navbar-center li { text-align: center;float: none;display: inline-block;}
Could someone please assist me to how I can get the logo to overflow the menu. Thanks in advance!
Try this
.pix_nav_logo {
position: absolute;
}
You can adjust the logo by playing with different values for css property left and right for .pix_nav_logo.
position: absolute : The element is positioned relative to its first positioned (not static) ancestor element.
.pix_nav_logo {
background: url(../images/t_logo.png) no-repeat;
padding-top: 0px;
overflow: visible;
width: 100px; // This for your logo size
position: absolute; // This is absolute position of logo
}
.pix_nav_1 ul li a {
color: rgba(0, 0, 0, 0.5);
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-ms-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
}
;
.pix_nav_1 ul li a:hover {
//color: rgba(0,0,0,0.85);
opacity: 0.6;
}
.header_nav_1 {
padding: 0px !important;
box-shadow: none;
}
.pix_nav_logo {
background: url(../images/t_logo.png) no-repeat;
padding-top: 0px;
overflow: visible;
width: 100px;
position: absolute;
}
.navbar-center {
margin-left: auto;
margin-right: auto;
float: none;
position: relative;
text-align: center;
}
.navbar-center li {
text-align: center;
float: none;
display: inline-block;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div id="page" class="page">
<div class="pixfort_normal_1" id="section_header_2_dark">
<div class="header_nav_1 dark pix_builder_bg" style="background-image: none; background-color: rgb(13, 52, 64); padding-top: 0px; padding-bottom: 0px; box-shadow: none; border-color: rgb(255, 255, 255); background-size: auto; background-attachment: scroll; background-repeat: repeat;">
<div class="container">
<div class="sixteen columns firas2">
<nav role="navigation" class="navbar navbar-white navbar-embossed navbar-lg pix_nav_1">
<div class="containerss">
<div class="navbar-header">
<button data-target="#navbar-collapse-02" data-toggle="collapse" class="navbar-toggle pix_text" type="button">
<span class="sr-only ">Toggle navigation</span>
</button>
<img src="http://www.hjmt.com/blog/wp-content/uploads/2012/08/Logo_TV_2015.png" class="pix_nav_logo">
</div>
<div id="navbar-collapse-02" class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active propClone">Home</li>
<li class="propClone">About</li>
<li class="propClone">Workshops and Training</li>
<li class="propClone">Contact</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
</div>
</div>
<!-- container -->
</div>
</div>
Its a bootstrap agency landing page, The navigation bar functions properly in the desktop view and on the files that are kept offline.
But on the online version the navigation bar doesn't shrink when put into mobile view.
Link to the inline site.
This is how the navbar should work in mobile view
Navigation bar code:
.navbar-default .navbar-brand {
/*font-family: "Kaushan Script","Helvetica Neue",Helvetica,Arial,cursive;
color: #fed136;*/
}
.logo{
position:fixed;
/*size:10px;*/
width:160pt;
height:auto;
padding-top: 10px;
}
.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus,
.navbar-default .navbar-brand:active,
.navbar-default .navbar-brand.active {
color: #fec503;
}
.navbar-default .navbar-collapse {
border-color: rgba(255,255,255,.02);
}
.navbar-default .navbar-toggle {
order-color: #C51D1D;
background-color: #CA2222;
/*top: 31px;*/
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #fff;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
background-color: #CA2222;
}
/* Drop down */
#drop li ul li {
border-top: 0px;
}
/*Navigation text*/
.navbar-default .nav li a {
text-transform: uppercase;
font-family: Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif;
font-weight: 100;
font-size:15px;
letter-spacing: 1px;
color: #fff;
}
.navbar-default .nav li a:hover,
.navbar-default .nav li a:focus {
outline: 0;
color: #009DF7;
}
.navbar-default .navbar-nav>.active>a {
border-radius: 0;
color: #fff;
background-color: rgba(255, 0, 0, 0.66);
}
.navbar-default .navbar-nav>.active>a:hover,
.navbar-default .navbar-nav>.active>a:focus {
color: #fff;
background-color: rgba(255, 0, 0, 0.66);
padding-top: 15px;
}
#media(min-width:768px) {
.navbar-default {
padding: 25px 0;
border: 0;
background-color: transparent;
-webkit-transition: padding .3s;
-moz-transition: padding .3s;
transition: padding .3s;
}
.navbar-default .navbar-brand {
font-size: 2em;
-webkit-transition: all .3s;
-moz-transition: all .3s;
transition: all .3s;
}
.navbar-default .navbar-nav>.active>a {
border-radius: 3px;
}
/*navigation color*/
.navbar-default.navbar-shrink {
padding: 3px;
background-color: rgba(0, 0, 0, 0.57);
}
.navbar-default.navbar-shrink .navbar-brand {
font-size: 2em;
}
<nav class="navbar navbar-default navbar-fixed-top navbar-shrink">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header page-scroll">
<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 page-scroll" href="#page-top"><img class="logo" width="80%" src="img/logos/U2.png" style="
margin-top: -22px;
"></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="navbar-collapse collapse" id="bs-example-navbar-collapse-1" aria-expanded="false" style="height: 0px;">
<ul class="nav navbar-nav navbar-right">
<li class="hidden active">
</li>
<li class="">
<a class="page-scroll" href="#services">Tandem skydiving</a>
</li>
<li class="">
<a class="page-scroll" href="#learn">Learn to skydive</a>
</li>
<li class="">
<a class="page-scroll" href="#hubs">microlite and paragliding</a>
</li>
<li class="">
<a class="page-scroll" href="#book">BOOK NOW</a>
</li>
<li class="">
<a class="page-scroll" href="#socialmedia">About us</a>
</li>
<!--<li>
<a class="page-scroll" href="#team">Team</a>
</li>
<li>
<a class="page-scroll" href="#contactus">connect</a>
</li>-->
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
Man you just use the Bootstrap CDN reference for online lookup. this Code is working with CDN connectivity. So please link CDN bootstrap css and script.
The problem on this page http://iloveskydiving.in/coco is that you are missing the meta viewport.
<meta name="viewport" content="width=device-width, initial-scale=1">
When looking at this page: http://sky.promile.co/coco/ (the "original" one, where the iframe pulls its content) it's working fine. You need to add the meta tag also to the code of the first page. (why using an iframe by the way?)
I'm building a fairly simple site that I need to be somewhat responsive.
Right now, when I resize my browser, the nav menu overlaps the Logo header which becomes super messy.
HTML:
<div class='header'>
<header>
<h1>Prince Innocence</h1>
</header>
<nav class='main'>
<ul>
<li>Music</li>
<li>Store</li>
<li>Shows</li>
<li>Videos</li>
<li>Contact</li>
</ul>
<ul class='social'>
<li>
<a href='http://www.youtube.com/princeinnocenceband' target=_"blank">
<span class='icon-youtube'></span>
<span class='hidden'>Youtube</span>
</a>
</li>
<li>
<a href='http://www.instagram.com/Prince Innocence' target=_"blank">
<span class='icon-instagram'></span>
<span class='hidden'>Instagram</span>
</a>
</li>
<li>
<a href='http://Prince Innocence.tumblr.com' target=_"blank">
<span class='icon-tumblr'></span>
<span class='hidden'>Tumblr</span>
</a>
</li>
<li class='soundcloud'>
<a href='http://www.soundcloud.com/Prince Innocence' target=_"blank">
<span class='icon-soundcloud'></span>
<span class='hidden'>Soundcloud</span>
</a>
</li>
<li>
<a href='http://www.twitter.com/Prince Innocence' target=_"blank">
<span class='icon-twitter'></span>
<span class='hidden'>Twitter</span>
</a>
</li>
<li>
<a href='http://www.facebook.com/Prince Innocence' target=_"blank">
<span class='icon-facebook'></span>
<span class='hidden'>Facebook</span>
</a>
</li>
</ul>
</nav>
</div>
And CSS:
.header {
width: 100%;
background: rgba(30, 30, 30, 0.6);
padding: 25px 0 20px 25px
}
.header h1 {
padding-right: 30px;
color: white;
font-family: Optima, Segoe, "Segoe UI", Candara, Calibri, Arial, sans-serif;
font-style: italic;
text-transform: uppercase;
color: #cccccc;
font-size: 300%
}
.header nav {
position: relative;
text-align: right;
margin-top: -50px;
margin-right: 30px
}
.header a, .header a:visited, header a:active {
color: #cccccc;
text-decoration: none
}
.header nav li {
display: inline;
padding: 0 5px 0 0
}
.header nav li a {
text-decoration: none;
font-size: 100%;
text-transform: uppercase;
color: #cccccc;
-o-transition: 1s;
-ms-transition: 1s;
-moz-transition: 1s;
-webkit-transition: 1s;
transition: 1s
}
Any thoughts? Thanks!
you have declared a negative margin on your nav element in .header nav
.header nav {
position: relative;
text-align: right;
margin-top: -50px; /* <-- THIS */
margin-right: 30px
}
if you take that away or change it to something closer to 0 you should have less overlap
Have you tried adding a clear:both; to the CSS for the logo header, which I guess is the <h1> element?