Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please type your username.

Please type your E-Mail.

Please choose an appropriate title for the post.

Please choose the appropriate section so your post can be easily searched.

Please choose suitable Keywords Ex: post, video.

Browse

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Navigation

  • Home
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Contact Us
Home/ Questions/Q 1183

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Latest Questions

Author
  • 62k
Author
Asked: November 25, 20242024-11-25T05:46:07+00:00 2024-11-25T05:46:07+00:00

Create Side Navigation bar with HTML and CSS

  • 62k

Welcome back Guys!
Today I'm going to show you how easily you can create a side navigation bar with using simple HTML and basic CSS. So let's get started with HTML part.

Reference Video:

<html lang="en"> <head>     <meta charset="UTF-8">     <meta http-equiv="X-UA-Compatible" content="IE=edge">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>Sticky Side Navigation Bar</title>     <link rel="stylesheet" href="style.css"> </head> <body>     <div class="nav-bar">         <ul>             <li><a href="#">Home</a></li>             <li><a href="#">About</a></li>             <li><a href="#">Pricing</a></li>             <li><a href="#">Contact us</a></li>         </ul>     </div>     <div class="content">         Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptate, quibusdam est tempora sint repellendus impedit expedita obcaecati sapiente, eligendi nobis praesentium quidem aliquam earum explicabo dicta veniam sunt reprehenderit nemo hic et itaque nulla a? Unde, id. Officiis suscipit excepturi impedit provident cumque, sunt necessitatibus ad nobis nesciunt commodi, labore voluptates repellat? Aliquam, suscipit et recusandae, atque delectus unde ab veniam quam commodi aut eum dolore dicta adipisci fugit quas animi obcaecati harum voluptatem? Ad voluptatum, rerum adipisci dolorum culpa molestiae error vero. Nemo laudantium necessitatibus praesentium dignissimos sint similique pariatur rerum vitae officia vero earum facere, molestiae cumque? Quisquam.     </div>     <script src="main.js"></script> </body> </html> 
Enter fullscreen mode Exit fullscreen mode

We added 4 random links in div tag class (nav-bar) and dummy text in another div tag class (content). And that's enough for HTML.
And now it's time to jump into the most important part i.e. CSS.

      *{         box-sizing: border-box;         }         html,body{             margin: 0;             padding: 0;         }         .nav-bar{             background: lightgray;             width: 30%;             height: 100%;             position: fixed;             top: 0;             left: 0;             overflow-y: auto;         }         .nav-bar a{             text-decoration: none;             color: red;             display: block;         }         .nav-bar ul{             list-style-type: none;             margin: 0;             padding: 0;         }         .nav-bar ul li a{             padding: 10px;             background: lightgray;          }          .nav-bar ul li a:hover{             background: #173459;         }         .nav-bar li{             border-bottom: 1px solid #333;         }         .nav-bar li:last-child{             border: none;         }         .content{             margin-left: 30%;             width: 70%;             padding: 2%;         } 
Enter fullscreen mode Exit fullscreen mode

Important Note:-
• In class “nav-bar” we set width of the nav-bar 30% so it covers only 30% of screen.
• We set overflow-Y to auto. So, if content amount increases then there will be a slide-bar.
• Now for content we set margin-left: 30% because in that 30% part we want to display the navigation bar.
• And set width: 70% so that remaining part is covered by the content.
That's it. We just created a sticky side Navigation Bar using basic HTML and CSS.

I Hope you loved ♥ it ☻

beginnerscsshtmlwebdev
  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question

Stats

  • Questions 4k
  • Answers 0
  • Best Answers 0
  • Users 2k
  • Popular
  • Answers
  • Author

    ES6 - A beginners guide - Template Literals

    • 0 Answers
  • Author

    Understanding Higher Order Functions in JavaScript.

    • 0 Answers
  • Author

    Build a custom video chat app with Daily and Vue.js

    • 0 Answers

Top Members

Samantha Carter

Samantha Carter

  • 0 Questions
  • 20 Points
Begginer
Ella Lewis

Ella Lewis

  • 0 Questions
  • 20 Points
Begginer
Isaac Anderson

Isaac Anderson

  • 0 Questions
  • 20 Points
Begginer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore, ask, and connect. Join our vibrant Q&A community today!

About Us

  • About Us
  • Contact Us
  • All Users

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help

  • Knowledge Base
  • Support

Follow

© 2022 Querify Question. All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.