Sticky Navbar Design in HTML
Sticky Navbar Design in HTML. In this article, I am going to tell you how you can create a very beautiful Website in HTML and CSS with simple steps. you just need to write a simple code of text to create this HTML website. we will use in this code HTML and simple internal CSS.
first of all, you have to create a folder, where you want to create a save you file of code and then drag it or open it on your text editor, after that you have to save this file by giving any name with the extension name HTML.
HTML Code
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Restaurant website template with html and css</title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<!-- custom css file link -->
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<!-- header section start -->
<header>
<a href="#" class="logo"><img src="logo1.png"></a>
<!-- <a href="#" class="logo"><img style="width:200px;" src="logo.png"></a> -->
<nav class="navbar">
<a href="#home" class="active">home</a>
<a href="#about">about</a>
<a href="#menu">menu</a>
<a href="#team">team</a>
<a href="#reservation">reservation</a>
<a href="#blog">blog</a>
</nav>
<div class="icons">
<i class="fas fa-bars" id="menu"></i>
<i class="fas fa-search"></i>
<i class="fas fa-heart"></i>
<i class="fas fa-shopping-cart"></i>
</div>
</header>
<!-- header section end -->
<section>
<h1>FITNESS<br> CLUB</h1>
</section>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing 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>
<script type="text/javascript">
let menu = document.querySelector('#menu');
let navbar = document.querySelector('.navbar');
menu.onclick = () =>{
menu.classList.toggle('fa-times');
navbar.classList.toggle('active');
}
</script>
</body>
</html>
CSS Code
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700&display=swap');
:root
{
--light-red: rgba(200,35,54,.9);
--black: #000;
--box-shadow: 0 .5rem 1.5rem rgba(0,0,0,.1);
}
*
{
font-family: 'Roboto', sans-serif;
margin: 0;
padding: 0;
box-sizing: border-box;
text-decoration: none;
text-transform: capitalize;
transition: all .2s linear;
}
html
{
font-size: 62.5%;
}
/*navbar style start*/
header
{
position: fixed;
top: 0;
left: 0;
right: 0;
background: var(--light-red);
padding: 1.8rem 7%;
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: var(--box-shadow);
z-index: 10000;
}
header .logo img
{
width:100px;
}
header .navbar a
{
font-size: 1.7rem;
padding: .5rem 1.5rem;
color: var(--black);
font-weight: 300;
border: .1rem solid transparent;
}
header .navbar a.active,
header .navbar a:hover
{
color: #fff;
border: .1rem solid rgba(205, 170, 124, 0.2);
}
header .icons i
{
cursor: pointer;
margin-left: .5rem;
height: 4.5rem;
width: 4.5rem;
line-height: 4.5rem;
background: var(--black);
text-align: center;
font-size: 1.7rem;
color: #fff;
}
header .icons i:hover
{
color: #fff;
background: var(--black);
border-radius: 100%;
color: var(--light-red);
}
header .icons #menu
{
display: none;
}
section
{
width: 100%;
height: 100vh;
background: #000;
position: relative;
background-image: url(back8.png);
background-size: cover;
background-attachment: fixed;
}
section h1
{
font-size: 150px;
padding: 200px 0 0 100px;
font-family: 'Fast Track', sans-serif;;
color: var(--light-red);
z-index: -1;
text-shadow: 5px 5px 2px rgba(255,255,255,.3);
}
/*navbar style end here*/
@media (max-width: 878px)
{
/*navbar media query*/
header .icons #menu
{
display: inline-block;
}
header .navbar
{
position: absolute;
top: 100%;
left: 0;
right: 0;
background: #eee;
border-top: .1rem solid rgba(205,170,124,0.2);
border-bottom: .1rem solid rgba(205,170,124,0.2);
padding: 1rem;
clip-path: polygon(0 0,100% 0,100% 0,0 0);
}
header .navbar.active
{
clip-path: polygon(0 0,100% 0,100% 100%,0 100%);
}
header .navbar a
{
display: block;
padding: 1.5rem;
margin: 1rem;
font-size: 2rem;
background: var(--light-red);
}
}
Here we completed our tutorial.
If you face any problem
please feel free to contact us.
Thanks for reading our post.
56 thoughts on “Sticky Navbar Design in HTML and CSS”
I was recommended this blog by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my problem. You're incredible! Thanks!
thanks for your support
Everyone loves it whenever people get together and share opinions. Great blog, keep it up!
Amazing blog! Do you have any hints for aspiring writers? I'm planning to start my own website soon but I'm a little lost on everything. Would you advise starting with a free platform like WordPress or go for a paid option? There are so many options out there that I'm totally confused .. Any tips? Cheers!
Hey There. I discovered your blog the usage of msn. That is an extremely neatly written article. I will be sure to bookmark it and come back to learn extra of your useful information. Thanks for the post. I will definitely return.
Asking questions are really pleasant thing if you are not understanding something totally, except this article provides nice understanding yet.
My partner and I stumbled over here by a different page and thought I may as well check things out. I like what I see so now i am following you. Look forward to looking over your web page repeatedly.
This is very fascinating, You are an overly skilled blogger. I've joined your feed and sit up for in search of more of your fantastic post. Also, I have shared your site in my social networks
Good blog post. I absolutely appreciate this site. Thanks!
Having read this I thought it was extremely enlightening. I appreciate you finding the time and effort to put this short article together. I once again find myself spending way too much time both reading and posting comments. But so what, it was still worth it!
Hi there I am so grateful I found your webpage, I really found you by error, while I was looking on Digg for something else, Nonetheless I am here now and would just like to say kudos for a tremendous post and a all round enjoyable blog (I also love the theme/design), I don't have time to read through it all at the minute but I have bookmarked it and also added your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the great work.
I got this website from my friend who told me about this site and now this time I am visiting this web site and reading very informative posts at this time.
Great information. Lucky me I came across your site by chance (stumbleupon). I've saved it for later!
Greetings! Very useful advice within this post! It's the little changes that make the biggest changes. Many thanks for sharing!
Your style is so unique in comparison to other people I have read stuff from. I appreciate you for posting when you have the opportunity, Guess I will just book mark this web site.
Thanks to my father who stated to me regarding this weblog, this weblog is actually remarkable.
Howdy! This is kind of off topic but I need some guidance from an established blog. Is it hard to set up your own blog? I'm not very techincal but I can figure things out pretty fast. I'm thinking about making my own but I'm not sure where to start. Do you have any ideas or suggestions? Cheers
Hello to all, it's really a fastidious for me to visit this web page, it contains important Information.
Oh my goodness! Impressive article dude! Thank you, However I am encountering problems with your RSS. I don't know the reason why I cannot join it. Is there anybody getting similar RSS issues? Anyone who knows the solution can you kindly respond? Thanx!!
Appreciate the recommendation. Let me try it out.
I am curious to find out what blog system you happen to be using? I'm experiencing some small security problems with my latest blog and I would like to find something more safeguarded. Do you have any suggestions?
I do not even understand how I stopped up here, but I thought this post used to be great. I do not know who you're however certainly you're going to a well-known blogger in case you are not already. Cheers!
Hi there, always i used to check blog posts here early in the daylight, since i love to gain knowledge of more and more.
Quality posts is the important to attract the viewers to pay a quick visit the web page, that's what this web page is providing.
Nice post. I was checking continuously this blog and I'm inspired! Extremely useful info specifically the remaining phase 🙂 I deal with such information a lot. I used to be looking for this particular info for a very long time. Thank you and best of luck.
great points altogether, you just received a brand new reader. What could you suggest in regards to your publish that you made some days ago? Any positive?
Hey! This post could not be written any better! Reading through this post reminds me of my previous room mate! He always kept chatting about this. I will forward this write-up to him. Pretty sure he will have a good read. Thank you for sharing!
You actually make it seem so easy together with your presentation however I in finding this matter to be really one thing which I think I would by no means understand. It kind of feels too complicated and extremely broad for me. I am taking a look ahead on your next put up, I will try to get the grasp of it!
I am sure this piece of writing has touched all the internet viewers, its really really fastidious post on building up new webpage.
Hello to all, how is all, I think every one is getting more from this web page, and your views are nice in favor of new viewers.
Does your blog have a contact page? I'm having problems locating it but, I'd like to send you an e-mail. I've got some suggestions for your blog you might be interested in hearing. Either way, great blog and I look forward to seeing it develop over time.
This text is worth everyone's attention. Where can I find out more?
First off I want to say excellent blog! I had a quick question that I'd like to ask if you do not mind. I was curious to find out how you center yourself and clear your head prior to writing. I have had a difficult time clearing my mind in getting my ideas out. I do take pleasure in writing but it just seems like the first 10 to 15 minutes are lost just trying to figure out how to begin. Any recommendations or hints? Thanks!
Hey there! I understand this is somewhat off-topic but I needed to ask. Does running a well-established blog such as yours require a large amount of work? I am completely new to running a blog but I do write in my diary everyday. I'd like to start a blog so I can easily share my personal experience and views online. Please let me know if you have any suggestions or tips for brand new aspiring bloggers. Thankyou!
Hello there, just became alert to your blog through Google, and found that it is truly informative. I'm gonna watch out for brussels. I will be grateful if you continue this in future. A lot of people will be benefited from your writing. Cheers!
Hi, i think that i saw you visited my site thus i came to “return the favor”.I am attempting to find things to improve my website!I suppose its ok to use a few of your ideas!!
I'm pretty pleased to find this site. I need to to thank you for your time for this fantastic read!! I definitely appreciated every part of it and I have you saved to fav to see new stuff on your site.
I love your blog.. very nice colors & theme. Did you design this website yourself or did you hire someone to do it for you? Plz reply as I'm looking to construct my own blog and would like to know where u got this from. thank you
hiii.. i am a web developer and i created this website and blog and if you want to construct blog for you , then you can contact me on my whatsapp number +91 8146115525
Hey There. I found your blog using msn. This is a really well written article. I'll be sure to bookmark it and come back to read more of your useful information. Thanks for the post. I'll definitely return.
Hey! This is kind of off topic but I need some guidance from an established blog. Is it very hard to set up your own blog? I'm not very techincal but I can figure things out pretty fast. I'm thinking about making my own but I'm not sure where to start. Do you have any points or suggestions? Thank you
LucySrfkl Maglia Albania Mondiali 2022 WolfgangQ
MavisKimm nuova maglia fiorentina 2022 KiaCrawfo
JaimieGio maglie calcio KristianC
Excellent goods from you, man. I've bear in mind your stuff previous to
and you're just extremely great. I really like what you have received right here, certainly like what you're saying and the best way in which you say it.
You're making it entertaining and you still care for to stay it sensible.
I can not wait to learn much more from you. This is actually a wonderful web site.
Does your website have a contact page? I'm having trouble locating it but, I'd like to send you an e-mail. I've got some ideas for your blog you might be interested in hearing. Either way, great website and I look forward to seeing it improve over time.
After looking into a few of the articles on your blog, I truly appreciate your way of blogging. I saved it to my bookmark webpage list and will be checking back soon. Please visit my web site as well and tell me what you think.
I wanted to thank you for this very good read!! I definitely loved every bit of it. I have you book marked to look at new things you post…
My spouse and I absolutely love your blog and find a lot of your post's to be exactly I'm looking for. can you offer guest writers to write content for you? I wouldn't mind creating a post or elaborating on a few of the subjects you write in relation to here. Again, awesome web site!
I am regular visitor, how are you everybody? This post posted at this site is really nice.
I think this is a real great article.Really looking forward to read more. Awesome.
Good article. I absolutely appreciate this website. Stick with it!
This is a great tip especially to those fresh to the blogosphere.Brief but very accurate info... Thanks for sharing this one.A must read post!
Excellent blog post. I certainly love this website. Keep it up!
A motivating discussion is definitely worth comment. Theres no doubt that that you need to write more on this subject matter, it may not be a taboo matter but generally folks dont discuss such subjects. To the next! Kind regards!!
Nice post. I learn something new and challenging on blogs I stumbleupon every day. Its always interesting to read content from other writers and use something from other web sites.
Wow, superb blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your site is wonderful, let alone the content!
I am regular visitor, how are you everybody? This piece of writing posted at this web page
is in fact fastidious.
I feel this is among the most vital information for me. And i am satisfied studying your article. However wanna statement on some general things, The site taste is ideal, the articles is actually excellent : D. Just right task, cheers