Join TalkersCode Now !

Get Latest Tutorials And Links On Web Development
And Get Existing Offers Via Email

Create Floating Navigation Menu Using HTML And CSS

Friday, Jan 27, 2017

Tags:- HTML CSS


Floating navigation menu is a fixed menu which is generally placed in top or left side of the webpage.Floating navigation menu is used to show webpage navigation menu everytime even in scrolling this gives a nice effect to your webpage.So, in this tutorial we will show you how to create floating navigation menu using HTML and CSS.You may also like CSS3 animated navigation menu.


See Demo
Create Floating Navigation Menu Using HTML And CSS


To Create Floating Navigation Menu It Takes Only Two Steps:-

  1. Make a HTML file and define markup
  2. Make a CSS file and define styling


Step 1.Make a HTML file and define markup

We make a HTML file and save it with a name menu.html

<html>
<head>
<link href="menu_style.css" type="text/css" rel="stylesheet"/>
</head>
<body>
<div id="wrapper">

<div id='menu_div'>
<li id="sitename">Example<br>.com</li>
<li><a href="#">Home</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Help</a></li>
<li><a href="#">Feedback</a></li>
</div>

<div id="content">
<h1>Create Floating Navigation Menu Using HTML And CSS</h1>

<p>"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p>
<br>
<p>"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"</p>
<br>
<p>"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?"</p>
<br>
<p>"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat."<p>
</div>

</div>
</body>
</html>

In this step we two divs one for menu and another for webpage content.Under menu div we add some sample links and in content div we add some sample content so that user need to scroll the webpage and see the floating navigation menu.We also add 'menu_style.css' file which we were going to create in next step.You may also like responsive navigation menu using CSS.



Step 2.Make a CSS file and define styling

We make a CSS file and save it with a name menu_style.css

body
{
 margin:0 auto;
 padding:0px;
 text-align:center;
 width:100%;
 font-family: "Myriad Pro","Helvetica Neue",Helvetica,Arial,Sans-Serif;
 background-color:#ECF0F1;
}
#wrapper
{
 margin:0 auto;
 padding:0px;
 text-align:center;
 width:995px;	
}
#menu_div
{
 padding:0px;
 margin:0px;
 width:180px;
 height:100%;
 background-color:#2E2E2E;
 position:fixed;
 top:0px;
 left:0px;
}
#menu_div li
{
 border-bottom:1px solid #424242;
 list-style-type:none;
 text-align:left;
}
#menu_div #sitename
{
 font-size:40px;
 margin-top:50px;
 margin-bottom:30px;
 padding:0px;
 padding-left:10px;
 color:white;
 border-bottom:none;
 cursor:pointer;
}
#menu_div li a
{
 height:50px;
 line-height:50px;
 display:block;
 color:silver;
 text-decoration:none;
 font-size:18px;
 padding-left:20px;
}
#menu_div li:hover a
{
 color:white;
}
#content
{
 width:815px;
 margin-left:170px;
 margin-top:40px;
 text-align:center;
}
#content h1
{
 margin-top:50px;
 font-size:45px;
 color:#626567;
}
#content h1 p
{
 font-size:18px;
 width:100%;
 margin:0px;
 margin-top:10px;
}
#content p
{
 color:#4D5656;
 width:600px;
 margin-left:110px;
}

In this step we use simple styling to create floating navigation menu we give fixed position to our menu so that it will be visible every time even in scrolling of a webpage.You may also like slide in navigation menu using jQuery and CSS.



That's all, this is how to create floating navigation menu using HTML and CSS.You can customize this code further as per your requirement. And please feel free to give comments on this tutorial.

Join Us With Our 21000+ Subscribers And Get Our Latest Tutorials Update Via Email

Are You Starting A New Blog
Do You Want Best Web Hosting?

Try World's Best Web Hosting Provider BlueHost
At Just $3.95/mo

Hurry Up! Limited Time Offer

Yes, I Want To Check Out BlueHost

Check The World's Best SEO And All-In-One Marketing Toolkit
For Digital Marketing Professionals SEMRUSH

Check Out SEMRUSH