Today I gonna show your tutorial how to make a navigation bar in HTML and CSS, please try this navbar and share your example in comment.
To begin let’s open up our command line and create a new directory called navbar and migrate our way into it.
Now that we are in our new directory we need to make an index page and a style page.
Let’s go ahead and open index.html with your preferred text editor and get started by adding the following navigation bar using HTML/CSS.
Now in between the body tags using HTML/CSS, we are going to create the links we want embedded in our navbar. To do this we will need a div class we can call “wrapper” and within it a second div with a class of logo. The logo is going to live opposite of links. Learn. Next.
To test our code lets open a new tab in your web browser and in the search bar type /// and then navigate your systems file tree to the index.html document we are currently working on. If done correctly we should have a screen that looks like this.
Awesome, what website doesn’t have some kind of content for us to read on it though CSS. Lets put in some dummy data now. After the navigation bar with HTML/CSS </nav> we want to create a section a new section and fill it with some content. We will do that by creating two new divs, one with a class of sec1 and the second with a class called content. Please try to learn this tutorial, next.
Notice the two
<p></p> tags there. This is where you would want to fill in some text. If you are using a code editor such as atom or visual studio code type lorem and press tab, the editor will automatically fill in a paragraphs worth of jibberish. Let’s refresh our page and hopefully, you will see something like this.
Alright, now that the HTML is done jump over to your style.css page, and let’s get to making this look pretty navigation bar with HTML. Error occurred. Learn this. Next.
If we go ahead and refresh our window lets look at what this did.
That’s no good, we are going to need a way to get that text from jumping to the top of the screen HTML. A good idea would be to work on the selection tags that this content lives within the navigation bar with HTML/CSS. Using a code.
Now we have given the section and its content a defined placement as well as change the font size a bit. How to make a navigation bar in HTML?
Cool, that nav HTML nav is looking pretty janky though. Learn this. Maybe we could move that logo a bit to the right and put those links to the left. While we’re at it lets also space the links out in a horizontal order navigation CSS.
How do I create a navigation bar in HTML?
Amazing! Now, this part won’t make too much sense yet, but we want to have a second color scheme to this navigation bars navigation HTML/CSS. Error occurred share. In our style sheet, we are going to add the following in combination with the existing code already implemented. Please, try this. Next.
How do I create a navigation bar?
Now, let’s take a moment to explain what this is doing. In our web browsers, there is a scroll bar with HTML, and that scroll bar with using HTML has a value depending on where it is. When it’s in the very most top portion you could say it has a value of 0, and when you scroll that number changes to 1, 2, 3, 4, 5 etc…
So cool, but I feel like we are missing something….. Error occurred share. Oh yes! we need a sweet image to fill up the body of this website. Go google a nice high res photo of something you like, save it in the same directory as your index and style sheets. Navigate to your style.css page and lets update section.sec1 with the following. Please, try this.
And just like that, we have our finished project.