HTML/CSS/Bootstrap | Bootstrap Navbar


HTML/CSS/Bootstrap | Bootstrap Navbar



I'm newish to programming and brand new to HTML. Currently doing a class assignment for my Web Development class where we are making a web page for a fictional company called "DW Gift Company." One of the project requirements is a navbar at the top (not fixed) that leads to a few different sub-pages (About, Items, Order, etc.). However, I'm stuck on the navbar part and can't seem to get the navbar to look right.



Here's my code below. I've got the nav tag with what I'm fairly sure are the correct classes along with ul's and li's (I know ul is an un-ordered list but I'm not 100% sure what li is. I'm following an online vid from my prof and I'm Germ X level(99.9%) sure I've followed along right and typed exactly what he has but mine looks nothing like his(I've attached what its supposed to look like and what mine looks like as well as what he has).



My code:


<html>

<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-theme.css">
<link rel="stylesheet" href="css/DWstyle.css">
http://code.jquery.com/jquery-1.10.1.min.js
http://code.jquery.com/jquery-migrate-1.2.1.min.js
http://js/bootstrap.min.js

</head>

<body>
<img src="C:UsersMasonDesktoph4_starterDWGiftLogo.png">

<nav class="navbar navbar-expand-lg navbar-light bg-beige">
<a class="navbar-brand">DW Gift Company</a>


</nav>
</body>


</html>



Roughly what I want it to look like.



What mine looks like.



What my prof's looks like.



I imagine the bullets have something to do with the li's but I'm not sure.



Tl;dr: I'm trying to make a navbar in HTML for a website and it isn't looking like it's supposed to even though I feel like I've followed my instructors code exactly from his online video.





Did you check if your bootstrap's css is getting loaded on page ? Check your console for any errors
– Nandita Arora Sharma
Jun 29 at 4:50





Try including bootstrap's css like this <link rel="stylesheet" href="stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/…; integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
– Nandita Arora Sharma
Jun 29 at 4:54





Hi! The code you suggested worked like a charm it appears, but would you mind explaining what exactly it did?
– J Carpet
Jun 29 at 5:02





Answered your query
– Nandita Arora Sharma
Jun 29 at 5:08




3 Answers
3



Include bootstarp's files From its CDN paths like this


<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
https://code.jquery.com/jquery-3.3.1.slim.min.js
https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js
https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js



Most probably your files were not present where you are expecting them to be as per your your html code.


<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-theme.css">



These 2 lines mean that your css(bootstrap.min.css and bootstrap-theme.css) must be present in a folder named css parallel to the html.



You should either download the boostrap's css and keep them in folder named css parallel to your html file or just access the files from their CDN path (which is hosted by bootstrap itself) .


css




<html>

<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
https://code.jquery.com/jquery-3.3.1.slim.min.js
https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js
https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js

</head>

<body>
<nav class="navbar navbar-expand-lg navbar-light bg-beige">
<a class="navbar-brand"><img src="C:UsersMasonDesktoph4_starterDWGiftLogo.png">DW Gift Company</a>


</nav>
</body>


</html>





Thank you so much! I really appreciate it, I'm not sure I ever would have figured that out on my own lol
– J Carpet
Jun 29 at 5:11





You are welcome. :)
– Nandita Arora Sharma
Jun 29 at 5:11




I don't want to do your homework for you, but I can point you in the right direction.



https://getbootstrap.com/docs/4.0/components/navbar/



https://getbootstrap.com/docs/3.3/examples/navbar/





Thanks man. Not really a question about what we were learning in class, I got that part mostly it was more about why it wasn't working in the background (which Nandita answered) which wasn't covered in class. Thank you for the links again :)
– J Carpet
Jun 29 at 5:10



Try this code instead. I feel like your code is a bit hard for newbie to understand, and if you really want to know more about web development learn CSS rather than taking a leap to Bootstrap.


<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js

</head>

<body><nav class="navbar navbar-default">





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





Move your comment o the answer
– Ptaq666
Jun 29 at 6:43





Thank you haha. currently 5:45 am where I am and I started this at 8pm yesterday but after everyones help and about 50 open tabs I've made some progress and I think I'm starting to understand more about web dev. thanks for the advice!
– J Carpet
Jun 29 at 10:45






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

Opening a url is failing in Swift

Export result set on Dbeaver to CSV