Responsive Dropdown Menu Navigation Position Next To Logo CSS & HTML - html

I have a problem and its been killing me, been following various tutorials to create my navigation bar for my website but cant seem to get it right. The problem i have is that i cant position my navigation to be next to my logo when the screen is large. Everytime i shrink it down then click my menu button it appears in the same position as the last screen so im unable to see it.
Any help from experiance users will be much appreciated, the CSS & HTML i have is below.
/*Strip the ul of padding and list styling*/
ul {
list-style-type:none;
margin:0;
padding:0;
position: fixed;
}
/*Create a horizontal list with spacing*/
li {
display:inline-block;
float: left;
margin-right: 1px;
}
/*Style for menu links*/
li a {
display:block;
min-width:140px;
height: 50px;
text-align: center;
line-height: 50px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #fff;
background: #2f3036;
text-decoration: none;
}
/*Hover state for top level links*/
li:hover a {
background: #19c589;
}
/*Style for dropdown links*/
li:hover ul a {
background: #f3f3f3;
color: #2f3036;
height: 40px;
line-height: 40px;
}
/*Hover state for dropdown links*/
li:hover ul a:hover {
background: #19c589;
color: #fff;
}
/*Hide dropdown links until they are needed*/
li ul {
display: none;
}
/*Make dropdown links vertical*/
li ul li {
display: block;
float: none;
}
/*Prevent text wrapping*/
li ul li a {
width: auto;
min-width: 100px;
padding: 0 20px;
}
/*Display the dropdown on hover*/
ul li a:hover + .hidden, .hidden:hover {
display: block;
}
/*Style 'show menu' label button and hide it by default*/
.show-menu {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
text-decoration: none;
color: #fff;
background: #19c589;
text-align: center;
padding: 10px 0;
display: none;
}
/*Hide checkbox*/
input[type=checkbox]{
display: none;
}
/*Show menu when invisible checkbox is checked*/
input[type=checkbox]:checked ~ #menu{
display: block;
}
/*Responsive Styles*/
#media screen and (max-width : 760px){
/*Make dropdown links appear inline*/
ul {
position: static;
display: none;
}
/*Create vertical spacing*/
li {
margin-bottom: 1px;
}
/*Make all menu links full width*/
ul li, li a {
width: 100%;
}
/*Display 'show menu' link*/
.show-menu {
display:block;
}
}
#nav_wrapper{
}
#logo img{
max-width: 100%;
height: auto;
}
#nav{
background-color: #222;
width: 100%;
top:0px;
left:0px
}
<div id="pageWrapper"> <!-- page wrapper-->
<div id="nav"> <!-- nav-->
<div id="logo">
<img src="http://placehold.it/350x150" width="405" height="96" align="bottom" /></div>
<div id="nav_wrapper"> <!-- nav wrapper-->
<label for="show-menu" class="show-menu">Show Menu</label>
<input type="checkbox" id="show-menu" role="button">
<ul id="menu">
<li>Home</li>
<li>
About ↓
<ul class="hidden">
<li>Who We Are</li>
<li>What We Do</li>
</ul>
</li>
<li>
Portfolio ↓
<ul class="hidden">
<li>Photography</li>
<li>Web & User Interface Design</li>
<li>Illustration</li>
</ul>
</li>
<li>News</li>
<li>Contact</li>
</ul>
</div>
<!-- end of nav wrapper-->
</div> <!-- end of nav-->
</div> <!-- end of page wrapper-->

Follow these steps:
remove position: fixed; from your ul
use float: left on logo.
use float: right on nav.
code:
#logo {
float: left;
}
#nav_wrapper {
float: right;
}
and for smaller resolution:
#media screen and (max-width : 760px){
#logo, #nav_wrapper {
float: none;
}
}
#logo {
float: left;
}
#nav_wrapper {
float: right;
}
/*Strip the ul of padding and list styling*/
ul {
list-style-type:none;
margin:0;
padding:0;
}
/*Create a horizontal list with spacing*/
li {
display:inline-block;
float: left;
margin-right: 1px;
}
/*Style for menu links*/
li a {
display:block;
min-width:140px;
height: 50px;
text-align: center;
line-height: 50px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #fff;
background: #2f3036;
text-decoration: none;
}
/*Hover state for top level links*/
li:hover a {
background: #19c589;
}
/*Style for dropdown links*/
li:hover ul a {
background: #f3f3f3;
color: #2f3036;
height: 40px;
line-height: 40px;
}
/*Hover state for dropdown links*/
li:hover ul a:hover {
background: #19c589;
color: #fff;
}
/*Hide dropdown links until they are needed*/
li ul {
display: none;
}
/*Make dropdown links vertical*/
li ul li {
display: block;
float: none;
}
/*Prevent text wrapping*/
li ul li a {
width: auto;
min-width: 100px;
padding: 0 20px;
}
/*Display the dropdown on hover*/
ul li a:hover + .hidden, .hidden:hover {
display: block;
}
/*Style 'show menu' label button and hide it by default*/
.show-menu {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
text-decoration: none;
color: #fff;
background: #19c589;
text-align: center;
padding: 10px 0;
display: none;
}
/*Hide checkbox*/
input[type=checkbox]{
display: none;
}
/*Show menu when invisible checkbox is checked*/
input[type=checkbox]:checked ~ #menu{
display: block;
}
/*Responsive Styles*/
#media screen and (max-width : 760px){
#logo, #nav_wrapper {
float: none;
}
/*Make dropdown links appear inline*/
ul {
position: static;
display: none;
}
/*Create vertical spacing*/
li {
margin-bottom: 1px;
}
/*Make all menu links full width*/
ul li, li a {
width: 100%;
}
/*Display 'show menu' link*/
.show-menu {
display:block;
}
}
#nav_wrapper{
}
#logo img{
max-width: 100%;
height: auto;
}
#nav{
background-color: #222;
width: 100%;
top:0px;
left:0px
}
<div id="pageWrapper"> <!-- page wrapper-->
<div id="nav"> <!-- nav-->
<div id="logo">
<img src="http://placehold.it/350x150" width="405" height="96" align="bottom" /></div>
<div id="nav_wrapper"> <!-- nav wrapper-->
<label for="show-menu" class="show-menu">Show Menu</label>
<input type="checkbox" id="show-menu" role="button">
<ul id="menu">
<li>Home</li>
<li>
About ↓
<ul class="hidden">
<li>Who We Are</li>
<li>What We Do</li>
</ul>
</li>
<li>
Portfolio ↓
<ul class="hidden">
<li>Photography</li>
<li>Web & User Interface Design</li>
<li>Illustration</li>
</ul>
</li>
<li>News</li>
<li>Contact</li>
</ul>
</div>
<!-- end of nav wrapper-->
</div> <!-- end of nav-->
</div> <!-- end of page wrapper-->

1st of all you have to remove the max-width for the logo and the auto height as well, also you'll need to float the image container "DIV" to the left to float the navigation menu to its right, so you will need to do it like the following
CSS:
#nav_wrapper{
overflow:auto;
}
#logo img{
float:left;
}
the rest will be the same :)

Related

HTML navbar keeps disappearing and moving around the page whenever i zoom in or resize the window

WHEN RUNNING THIS CODE YOU HAVE TO VIEW IN FULL PAGE MODE
code for navigation, header, and style for both. whenever I zoom in or out on my browser the navbar keeps moving around and eventually it just disappears off of the screen, same thing happens whenever I try to resize the window.
I would like to my navbar to be responsive but remain inside of the header and not move around whenever the page is zoomed in. would greatly appreciate any help.
/* ---------- Navigation ---------- */
nav{
width: 100%;
height: 60px;
font-weight: bold;
color: white;
position: absolute;
bottom: 500px;
left: -250px;
}
nav ul{
float: right;
}
nav ul li{
float: left;
list-style: none;
position: relative;
}
nav ul li a{
font-family: arial;
color: black;
font-size: 20px;
padding: 22px 14px;
display: block;
text-decoration: none;
}
nav ul li ul{
display: none;
position: absolute;
background: #4f88bd;
padding: 10px;
border-radius: 0px 0px 4px 4px;
}
nav ul li:hover ul{
display: block;
}
nav ul li ul li{
width: 180px;
border-radius: 4px;
}
nav ul li ul li a{
padding: 8px 14px;
}
nav ul li ul li a:hover{
background: #26227d;
}
/* ---------- Navigation ---------- */
/* ---------- Header ---------- */
header{
background: #35424a;
color: #ffffff;
padding: 20px;
min-height: 70px;
text-align: left;
}
header h1{
font-size: 50px;
text-align: center;
}
header h1 a{
text-decoration: none;
color: white;
}
/* ---------- Header ---------- */
<header>
<h1>Olympic Class Liners</h1>
<nav>
<ul>
<li>Olympic
<ul>
<li>Overview</li>
<li>Crew</li>
<li>Decks</li>
<li>Passengers</li>
</ul>
</li>
<li>Titanic
<ul>
<li>Overview</li>
<li>Crew</li>
<li>Decks</li>
<li>Passengers</li>
<li>Sinking</li>
<li>Wreck</li>
</ul>
</li>
<li>Britannic
<ul>
<li>Overview</li>
<li>Crew</li>
<li>Decks</li>
<li>Passengers</li>
<li>Sinking</li>
<li>Wreck</li>
</ul>
</li>
<li>White Star Line
<ul>
<li>Overview</li>
<li>Crew</li>
<li>Decks</li>
</ul>
</li>
<li>Harlond and Wolff
<ul>
<li>Overview</li>
<li>Crew</li>
<li>Decks</li>
</ul>
</li>
<li>Galleries
<ul>
<li>Exterior Images</li>
<li>Interior Images</li>
</ul>
</li>
<li>Acknowledgments</li>
</ul>
</nav>
</header>
use media queries, here's an example:
/* Media Queries */
#media (max-width: 1024px) {
.nav li { width: 100%; }
.nav .dropdown ul {display:none; }
.nav .open ul { display: block; }
.nav-collapse .nav > li > a, .nav-collapse .dropdown-menu a {
text-align: center;
}

remove hover on submenu during media query

Im trying to remove the hover on my submenu when the media query is active. Right now it works how I want above 979px which displays the submenu on hover. However, at 979px and below the menu changes. Im trying to get the submenu to always display and can't seem to figure it out. there is a link attached to the services button so when its pressed to display the submenu you are re-directed whcih is why I want to display the submenu all the time at media query.
HTML:
<!-- Nav Bar -->
<div id="navbar">
<label for="show-menu" class="show-menu">Menu ☰</label>
<input type="checkbox" id="show-menu" role="button">
<ul id="menu" class="nav">
<li class="nav active">Home</li>
<li class="nav">
Services
<ul class="nav hidden">
<li>Fire Alarm Systems</li>
<li>Security & Intrusion</li>
<li>Closed Circuit TV</li>
<li>Access Control</li>
<li>Systems Intrigation</li>
</ul>
</li>
<li class="nav">About Us</li>
<li class="nav">Tech Support</li>
<li class="nav">Photo Gallery</li>
<li class="nav">Testimonials</li>
<li class="nav">Contact Us</li>
</ul>
</div>
<!-- Nav Bar End -->
CSS:
ul.nav
{ list-style-type:none;
margin:0;
padding:0;
position: absolute;}
li.nav
{ display:inline-block;
float: left;
margin-right: 2px;}
li.nav a {
display:block;
min-width:153px;
height: 40px;
text-align: center;
line-height: 40px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #fff;
background: #724e27;
text-decoration: none;
}
li.nav:hover a {
background: #cccccc;
color: #2f3036;
}
li.nav:hover ul a {
background: #f3f3f3; /* Light grey */
color: #2f3036; /* dark Grey */
height: 40px;
line-height: 40px;
}
li.nav:hover ul a:hover {
background: #996633; /* Light Brown */
color: #fff;
}
li.active a, li.active a:hover
{ background: #cccccc;
color: #2f3036;}
li.nav ul {
display: none;
}
li.nav ul li {
display: block;
float: none;
}
li.nav ul li a {
width: auto;
min-width: 100px;
padding: 0 20px;
}
ul.nav li a:hover + .hidden, .hidden:hover {
display: block;
z-index: 999;
}
.show-menu {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
text-decoration: none;
color: #261a0d;
background: #f3f3f3;
text-align: center;
padding: 10px 0;
display: none;
}
input[type=checkbox]{display: none;}
input[type=checkbox]:checked ~ #menu{display: block;}
/* Responsive Styles */
#media screen and (max-width : 979px){
ul.nav
{ position: static;
display: none;}
li.nav {margin-bottom: 1px;}
ul.nav li, li.nav a {width: 100%;}
.show-menu {display:block;}
}
you can use display: block !important inside your media query to display your sub-menu on smaller screen.
#media screen and (max-width : 979px){
li.nav > ul.hidden {
display: block !important;
}
}

Shrinking navbar when scrolling down, without using Javascript

How can get a navbar at the top of the page that shrinks when a visitor scrolls down, and without using Javascipt?
This is done here, for example. It would be fine for it to shrink discretely from wide to narrow, rather than shrink continuously as on that site.
(I don't this is a duplicate, because I am specifically asking for this to be done without using Javascript.)
What you are asking for is unfortunately outright impossible without JavaScript, as CSS has no way of knowing when the users scrolls down the page.
However, it is possible to shrink a header based on cursor position (which is almost the same thing) in pure CSS. See this answer by Mr Lister.
Hope this helps!
i this this will help you
/*Strip the ul of padding and list styling*/
ul {
list-style-type:none;
margin:0;
padding:0;
position: absolute;
}
/*Create a horizontal list with spacing*/
li {
display:inline-block;
float: left;
margin-right: 1px;
}
/*Style for menu links*/
li a {
display:block;
min-width:140px;
height: 50px;
text-align: center;
line-height: 50px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #fff;
background: #2f3036;
text-decoration: none;
}
/*Hover state for top level links*/
li:hover a {
background: #19c589;
}
/*Make dropdown links vertical*/
li ul li {
display: block;
float: none;
}
/*Prevent text wrapping*/
/*Style 'show menu' label button and hide it by default*/
.show-menu {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
text-decoration: none;
color: #fff;
background: #19c589;
text-align: center;
padding: 10px 0;
display: none;
}
/*Hide checkbox*/
input[type=checkbox]{
display: none;
}
/*Show menu when invisible checkbox is checked*/
input[type=checkbox]:checked ~ #menu{
display: block;
}
/*Responsive Styles*/
#media screen and (max-width : 760px){
/*Make dropdown links appear inline*/
ul {
position: static;
display: none;
}
/*Create vertical spacing*/
li {
margin-bottom: 1px;
}
/*Make all menu links full width*/
ul li, li a {
width: 100%;
}
/*Display 'show menu' link*/
.show-menu {
display:block;
}
}
<label for="show-menu" class="show-menu">Show Menu</label>
<input type="checkbox" id="show-menu" role="button">
<ul id="menu">
<li>Home</li>
<li>About</li>
<li>Portfolio </li>
<li>News</li>
<li>Contact</li>
</nav>

Responsive Nav Bar will not sit centrally in DIV

I've done lots of searching and testing on possible solutions, but can't get this responsive menu to sit central.
/**********HEADER ***************************/
.headerbar {
display:inline-block;
width:100%;
background:#007700;
margin-bottom:0px;
}
/******************/
/*********** NAVBACKER *********************/
.navback {
display:block;
height:32px;
border:2px solid grey;
background:grey;
margin:auto;
}
/***************/
/* START OF NAV STYLES ****************************/
/*Strip the ul of padding and list styling*/
ul {
list-style-type:none;
margin:0;
padding:0;
position: absolute;
}
/*Create a horizontal list with spacing*/
li {
display:inline-block;
float: left;
margin-right: 1px;
}
/*Style for menu links*/
li a {
display:block;
min-width:140px;
height: 30px;
text-align: center;
line-height: 30px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #fff;
background: #003300;
text-decoration: none;
border:1px solid green;
}
/*Hover state for top level links*/
li:hover a {
background: #006600;
}
/*Style for dropdown links*/
li:hover ul a {
background: #f3f3f3;
color: #2f3036;
height: 30px;
line-height: 30px;
}
/*Hover state for dropdown links*/
li:hover ul a:hover {
background: #006600;
color: #fff;
}
/*Hide dropdown links until they are needed*/
li ul {
display: none;
}
/*Make dropdown links vertical*/
li ul li {
display: block;
float: none;
}
/*Prevent text wrapping*/
li ul li a {
width: auto;
min-width: 100px;
padding: 0 20px;
}
/*Display the dropdown on hover*/
ul li a:hover + .hidden, .hidden:hover {
display: block;
}
/*Style 'show menu' label button and hide it by default*/
.show-menu {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
text-decoration: none;
color: #fff;
background: #003300;
text-align: center;
padding: 10px 0;
display: none;
}
/*Hide checkbox*/
input[type=checkbox]{
display: none;
}
/*Show menu when invisible checkbox is checked*/
input[type=checkbox]:checked ~ #menu{
display: block;
}
/*Responsive Styles*/
#media screen and (max-width : 760px){
/*Make dropdown links appear inline*/
ul {
position: static;
display: none;
}
/*Create vertical spacing*/
li {
margin-bottom: 1px;
}
/*Make all menu links full width*/
ul li, li a {
width: 100%;
}
/*Display 'show menu' link*/
.show-menu {
display:block;
height:12px;
}
}
/* END OF NAV STYLES ****************
<div class="headerbar">
<h1>Logo and some text</h1>
</div>
<div class="navback">
<!-- START OF NAVIGATION MENU -->
<label for="show-menu" class="show-menu">Show Menu</label>
<input type="checkbox" id="show-menu" role="button">
<ul id="menu">
<li>Home</li>
<li>
Latest ↓
<ul class="hidden">
<li>Pictures</li>
<li>Comments</li>
<li>Threads</li>
</ul>
</li>
<li>
Explore ↓
<ul class="hidden">
<li>Counties</li>
<li>Towns</li>
<li>Attractions</li>
<li><a href='#'>Picture Tours</a></li>
</ul>
</li>
<li>Upload</li>
<li>Login</li>
</ul>
</div>
<!-- END OF NAVIGATION MENU -->`enter code here`
Here is where I have been trying to get it to work: http://jsfiddle.net/
Every time I change the position:absolute, the menu when hovered, formats wrong. I've also tried margin:0 auto; etc but nothing I've tried will work, and I've tried removing the float. Any help is hugely appreciated.
Tree
Put
display: table;
margin: 0 auto;
in ul tag, like this:
ul {
list-style-type:none;
margin: 0;
padding:0;
display: table;
margin: 0 auto;
}
Here is fiddle - http://jsfiddle.net/p5oypc72/70/

Having trouble with css vertical menu under a <nav> tag

http://i.stack.imgur.com/dSQDe.jpg
My Problem: In the vertical menu, the drop-down part pushes the below content further downwards rather than over-lapping above the below content. This web page uses css media queries.
#charset "utf-8";
#wrapper{
margin:0 auto;
margin-top:-15px;
max-width:1020px;
width:97%;
background-color:#FFF;
border:1px solid #000;
border-radius:2px;
box-shadow:0 0 10px 0px rgba(12,3,25,1.8);
}
#slider{
overflow:hidden;
text-align:center;
min-width:320px;
height:auto;
width:100%;
}
#slider img{
width:inherit;
}
#header{
min-height:150px;
overflow:hidden;
z-index:5;
background-color:#fff;
width:100%;
display:inline;
}
#header img{
width:218px;
height:139px;
}
nav{
width:auto;
}
ul {
list-style-type:none;
margin:0;
padding:0;
}
/*Create a horizontal list with spacing*/
li {
display:inline-block;
float: left;
margin-right:#CF0;
}
/*Style for menu links*/
li a {
display:block;
min-width:150px;
height:100px;
text-align: center;
line-height:100px;
color: #fff;
background: #34D675;
text-decoration: none;
}
/*Hover state for top level links*/
li:hover a {
background: #99D829;
}
/*Style for dropdown links*/
li:hover ul a {
background: #f3f3f3;
color: #2f3036;
height: 40px;
line-height: 40px;
}
/*Hover state for dropdown links*/
li:hover ul a:hover {
background: #19c589;
color: #fff;
}
/*Hide dropdown links until they are needed*/
li ul {
display: none;
}
/*Make dropdown links vertical*/
li ul li {
display: block;
float: none;
}
/*Prevent text wrapping*/
li ul li a {
width: auto;
min-width: 100px;
padding: 0 20px;
}
/*Display the dropdown on hover*/
ul li a:hover + .hidden, .hidden:hover {
display: block;
}
/*Style 'show menu' label button and hide it by default*/
.show-menu {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
text-decoration: none;
color: #fff;
background: #19c589;
text-align: center;
padding: 10px 0;
display: none;
}
/*Hide checkbox*/
input[type=checkbox]{
display: none;
}
/*Show menu when invisible checkbox is checked*/
input[type=checkbox]:checked ~ #menu{
display: block;
}
/*Responsive Styles*/
#media screen and (max-width : 760px){
/*Make dropdown links appear inline*/
ul {
position: static;
display: none;
}
/*Create vertical spacing*/
li {
margin-bottom: 1px;
}
/*Make all menu links full width*/
ul li, li a {
width: 100%;
}
/*Display 'show menu' link*/
.show-menu {
display:block;
}
}
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="style.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>NFF - Sri Lanka</title>
</head>
<body>
<div id="wrapper">
<div id="header">
<nav>
<a href="#">
<img src="file:///E|/NFF -Website/images/nfflogo.jpg" alt="NFF Sri Lanka Logo" width="218" height="139" title="NFF Sri Lanka Logo" ></a>
<label for="show-menu" class="show-menu">Show</br>Menu</label>
<input type="checkbox" id="show-menu" role="button">
<ul id="menu">
<li>HOME</li>
<li>INFO ↓
<ul class="hidden">
<li>National Rainforests</li>
<li>Aninmals & Plants</li>
<li>Nature Convservation</li>
</ul>
</li>
<li>BLOG</li>
<li>ABOUT ↓
<ul class="hidden">
<li>Our Mission & Vision</li>
<li>Membership</li>
<li>Donate us</li>
</ul>
</li>
</ul>
</nav>
</div>
<div id="slider">
<img src="images/slider.jpg" alt="NFF Sri Lanka slider" title="NFF Sri Lanka Slider">
</div>
</div>
<p style="text-align:center; padding:0px;"> © Copyright 2014 - Damitha N. Wanniarachchi </p>
</body>
</html>
Add position: absolute; to .hidden and position: relative; to .hidden for #media query max-width : 760px like this:
JSFiddle - DEMO
.hidden {
position: absolute; /* Add this */
}
#wrapper {
margin:0 auto;
margin-top:-15px;
max-width:1020px;
width:97%;
background-color:#FFF;
border:1px solid #000;
border-radius:2px;
box-shadow:0 0 10px 0px rgba(12, 3, 25, 1.8);
}
#slider {
overflow:hidden;
text-align:center;
min-width:320px;
height:auto;
width:100%;
}
#slider img {
width:inherit;
}
#header {
min-height:150px;
overflow:hidden;
z-index:5;
background-color:#fff;
width:100%;
display:inline;
}
#header img {
width:218px;
height:139px;
}
nav {
width:auto;
}
ul {
list-style-type:none;
margin:0;
padding:0;
}
/*Create a horizontal list with spacing*/
li {
display:inline-block;
float: left;
margin-right:#CF0;
}
/*Style for menu links*/
li a {
display:block;
min-width:150px;
height:100px;
text-align: center;
line-height:100px;
color: #fff;
background: #34D675;
text-decoration: none;
}
/*Hover state for top level links*/
li:hover a {
background: #99D829;
}
/*Style for dropdown links*/
li:hover ul a {
background: #f3f3f3;
color: #2f3036;
height: 40px;
line-height: 40px;
}
/*Hover state for dropdown links*/
li:hover ul a:hover {
background: #19c589;
color: #fff;
}
/*Hide dropdown links until they are needed*/
li ul {
display: none;
}
/*Make dropdown links vertical*/
li ul li {
display: block;
float: none;
}
/*Prevent text wrapping*/
li ul li a {
width: auto;
min-width: 100px;
padding: 0 20px;
}
/*Display the dropdown on hover*/
ul li a:hover + .hidden, .hidden:hover {
display: block;
}
/*Style 'show menu' label button and hide it by default*/
.show-menu {
font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;
text-decoration: none;
color: #fff;
background: #19c589;
text-align: center;
padding: 10px 0;
display: none;
}
/*Hide checkbox*/
input[type=checkbox] {
display: none;
}
/*Show menu when invisible checkbox is checked*/
input[type=checkbox]:checked ~ #menu {
display: block;
}
/*Responsive Styles*/
#media screen and (max-width : 760px) {
/*Make dropdown links appear inline*/
.hidden {
position: relative; /* Add this */
}
ul {
position: static;
display: none;
}
/*Create vertical spacing*/
li {
margin-bottom: 1px;
}
/*Make all menu links full width*/
ul li, li a {
width: 100%;
}
/*Display 'show menu' link*/
.show-menu {
display:block;
}
}
<div id="wrapper">
<div id="header">
<nav>
<a href="#">
<img src="file:///E|/NFF -Website/images/nfflogo.jpg" alt="NFF Sri Lanka Logo" width="218" height="139" title="NFF Sri Lanka Logo" ></a>
<label for="show-menu" class="show-menu">Show</br>Menu</label>
<input type="checkbox" id="show-menu" role="button">
<ul id="menu">
<li>HOME
</li>
<li>INFO ↓
<ul class="hidden">
<li>National Rainforests
</li>
<li>Aninmals & Plants
</li>
<li>Nature Convservation
</li>
</ul>
</li>
<li>BLOG
</li>
<li>ABOUT ↓
<ul class="hidden">
<li>Our Mission & Vision
</li>
<li>Membership
</li>
<li>Donate us
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div id="slider">
<img src="images/slider.jpg" alt="NFF Sri Lanka slider" title="NFF Sri Lanka Slider">
</div>
</div>
<p style="text-align:center; padding:0px;">© Copyright 2014 - Damitha N. Wanniarachchi</p>
You might want to try:
div1 {
overflow-y: visible;
}
or
div1 {
overflow-y: scroll;
}
alternatively, you could adjust the margins on the lower portion, using negative margins:
div2 {
margin-top: -100px;
}