Unfixed Navigation Bar in front of image - html

I have put an image on the top of my page, but I also want to insert a navigation bar on the top of the page (in front of the image). But the reality the navigation bar is above the image, I cant put them both on the same row, I can do it with make the navibar fixed top, but its really annoying when I scroll down. Is there any way to solve my problem?
(PS: Image is not a background!)
<nav class="navbar " role="navigation">
<div class="container-fluid">
<div class="collapse navbar-collapse navbar-right navbar-main-collapse">
<ul class="nav navbar-nav">
<li>
<a> Link </a>
</li>
<li>
<a> Link </a>
</li>
<li>
<a> Link </a>
</li>
<li>
<a> Link </a>
</li>
<li>
<a> Link </a>
</li>
</ul>
</div>
</div>
</nav>
<img src=" ">

This should work:
.navbar {
position: absolute;
top: 0;
left: 0;
}
See: https://jsfiddle.net/tcybj6sj/
You basically had the right idea: Pin the nav bar to the top of the page. But instead of using position: fixed, which pins the nav bar to a fixed position within the browser window, use position: absolute, which pins the nav bar to a fixed position within the page.

Related

How would I prevent body from scrolling even when scrolling on hamburger menu?

I have a hamburger menu scrolled all the way to the bottom of the screen. The problem I'm facing is that even when I scroll my finger up and down on the hamburger menu, the entire page scrolls along with it.
I've tried numerous solutions online but can't seem to get it working.
Below is my current HTML and numerous attempts with CSS (too many to list).
What's a good way to tackle this problem?
Here's my HTML:
<div class="mobile-nav container">
<div class="collapse navbar-collapse" id="user-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
Item 1
</li>
<li>
Item 2
</li>
<li>
Item 3
</li>
<li>
Item 4
</li>
<li>
Item 5
</li>
<li>
Item 6
</li>
<li>
Item 7
</li>
<li>
Item 8
</li>
</ul>
</div>
Attempts with CSS:
mobile-nav.container {
border-top: 2px solid #f47e1f;
overflow: hidden;
position: absolute;
}
#user-navbar-collapse-1 {
position: fixed;
overflow: hidden;
}
Most of the time the overflow: hidden; CSS property on the body, html should do the trick. Setting also the height: 100% and margin: 0 is advised, but usually not necessary.

Bootstrap Nav Bar problems

I am having trouble with my nav bar, the first link in the nav bar is always to low. There seems to be a hidden <a> tag in it that I can not remove. This wasnt there until I added a link to the logo on the left. When the logo was not a link the first link stayed in the correct position. I have uploaded some of the code to codepen
https://codepen.io/BitRot86/pen/qXgQzE
Any ideas would be helpful
There are two small typo mistakes in your HTML code.
<ul class="nav navbar-nav" id="navLeft">
<li>
#*<a href="index.php"><img src="http://gbcsite.ca/v5/images/GBC-logo.png" class="img-responsive" width="200px"><a />*#
<a href="index.php">
<img src="http://gbcsite.ca/v5/images/GBC-logo.png" class="img-responsive" width="200" />
</a>
</li>
</ul>
First, you've not closed the <img> tag.
Second, you've incorrectly closed <a> tag under image link.
I've fixed it at my end and it is working.

In scrollable vertical menu, submenu not showing on right side

After adding position:fixed and overflow:scroll property menu is scrolled but submenu does not show on right side bar or when I remove property overflow then right side bar menu shows but parent menu does not scroll.
<nav id="cssmenu" style="display:none">
<ul class="level0_category">
<li class="parentMenus"> Men's Corner </li>
<li class="parentMenus"> Women's Corner </li>
<li class="parentMenus"> House of Electronics
<ul class="level1_category">
<li>Laptop</li>
<li>Mobile</li>
<li>Printers</li>
<li>AC</li>
<li>Refrigerator</li>
</ul>
</li>
</ul>
</nav>
nav#cssmenu{margin:0 auto;position: fixed; height: 100%; width: 350px;left: -600px}
enter image description here
enter image description here

Adding a left logo to my navigation bar

I'm trying to set my company logo on my header navigation bar with no luck. I tried by adding before the nav itself but it's not centering the content. The image is shown first and the messy menu after that.
<header>
<img src="http://i.imgur.com/jNwTPBi.png">
<nav id="nav" class="ry">
<ul id="main-menu">
<li>
</i>Home
</li>
<li>
</i>About
</li>
<li>
</i>Our work
</li>
<li>
</i>Work
</li>
<li>
</i>Contact
</li>
</ul>
</nav>
</header>
You can try it right here, by adding <img src="http://i.imgur.com/jNwTPBi.png">: http://codepen.io/anon/pen/XKKPGO
How can I put the logo on the left so I can get something like the following solution? I guess I've to make some changes on the .css but I dont know what do I have to edit.
Thanks in advance.
Your CSS is over whelming. All you would need to do is give/create the wrapper a position of relative and the logo the position absolute.
<header>
<div class="wrapper"> ..
<img src="http://i.imgur.com/jNwTPBi.png" class="logo"> ..
header .wrapper {
width: 1100px;
margin: 0 auto;
position: relative;
}
header .wrapper .logo {
position: absolute;
left: 0;
}
i think it's super easy, so i think it might answer ur question
<header>
<div class="with_class">
<img src="">
</div>
<nav></nav>
</header>
put a wrapper div on your image and put an absolute position with it.
width whatever div width u want and height same as ur header. have you ever tried it before?

Navigation bar masking

What I want to achieve here, is to transparent navigation bar hide anything underneath and leave background only. So if you scroll down the page anything that goes under fixed navbar will be hidden. I've googled it but didn't found any satisfying results. Is it even possible?
Here's the demo site: http://klaunfizia.pl/damian/
Style: http://klaunfizia.pl/damian/style.css
what I got now: http://i.imgur.com/6k2yNJbh.jpg
What I want to achieve: http://i.imgur.com/VICvrUDh.jpg
Background image isn't solid, so setting navigation bar color to #ff7400 won't be a solution.
code:
<ul id="menu">
<li>
<a href="#">
Home
</a>
</li>
<li>
<a href="#">
About me
</a>
</li>
<li>
<a href="#">
Portfolio
</a>
</li>
<li>
<a href="#">
Contact
</a>
</li>
</ul>
</nav>
<section id="container">
<section id="main">
<h1>hi! My name is Damian</h1>
<p class="mainText">
I'm a graphic designer from Poland specializing in web design, 3D modeling, vector graphics and digital drawing. See my portfolio for more information.
</p>
</section>
</section>
css:
#navbar
{
height: 80px;
width: 100%;
position: fixed;
-webkit-transform: translateZ(0);
z-index: 10;
top:0;
}
Why can't you set the same background color and image as the body?
#navbar {
background: url(images/background.jpg) #ff7400;
}
Works just dandy in Chrome dev tools.
Assuming that your header/menu container has a solid background color, this looks like a simple z-index issue. Give your menu a higher z-index.
If you could provide more code or a jsfiddle, I could tell you exactly which line of css to add/remove/fix. Unfortunately your site isn't loading.