Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAlex Chow
4,521 PointsBootstrap Navbar Links
I'm using Bootstrap to create a webpage. In the navbar I have several links that should lead to external pages. In the HTML, I've used this line of code: <li><a href="gallery.html">Gallery</a></li> to create one of the links. All of these are placed under the "navbar" class. When I test the site in the browser, the link shows it's going to lead to the correct page (Firefox shows the link address preview at the bottom left corner of the page) but it doesn't open. I've tested this on buttons across the page to see if it was an issue with the code but they all work fine. This issue only happens to the links placed in the navbar. Is there something I need to fix in the Bootstrap files?
Thank you in advance.
1 Answer
Justin Riley
3,175 PointsStupid question, do you have all the pages in the same folder? i know a lot of my linking issues or even image issues come when i dont get the directory path correct.
I don't know that bootstrap would effect the link as that is html and not CSS? but i also dont have much experience with it yet.
Alex Chow
4,521 PointsAlex Chow
4,521 PointsHey there,
Yup, the paths are correct and in the same folder. I wasn't able to find a solution but I did find a work-around using some scripts. I had to assign each link an ID (ie. Home) and used the following script for each of them which worked out well: <script> document.getElementById("Home").onclick = function () { location.href = "Index.html"; }; </script>