Difficulty displaying list items/links in Bootstrap Navbar

Currently, I am diving into the world of Bootstrap and experimenting with different components, particularly the navbar feature.

However, I've encountered an issue where my links or list items are not visible on the page. I have double-checked the code to ensure it matches the Bootstrap documentation, but still can't seem to figure out what's missing.

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>NavBar</title>

    <!-- bootstrap css -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" integrity="sha384-y3tfxAZXuh4HwSYylfB+J125MxIs6mR5FOHamPBG064zB+AFeWH94NdvaCBm8qnd" crossorigin="anonymous">
</head>    
<body>      
    <nav class="navbar navbar-toggleable-md navbar-light bg-faded">
        <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <a class="navbar-brand" href="#">Navbar</a>
        <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
            <div class="navbar-nav">
                <a class="nav-item nav-link active" href="#">Home <span class="sr-only">(current)</span></a>
                <a class="nav-item nav-link" href="#">Features</a>
                <a class="nav-item nav-link" href="#">Pricing</a>
                <a class="nav-item nav-link disabled" href="#">Disabled</a>
            </div>
        </div>
    </nav>      
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/js/bootstrap.min.js" integrity="sha384-vZ2WRJMwsjRMW/8U7i6PWi6AlO1L79snBrmgiDpgIWJ82z8eA5lenwvxbMV1PAh7" crossorigin="anonymous">
    </script>   
</body>

Answer №1

When working with Bootstrap 4, don't forget to include the navbar-expand-* class in order to display the horizontal navbar properly. Otherwise, it may collapse into its mobile version.

Ensure that you have linked to the correct Bootstrap CSS file in your Codepen like this:

Alternatively, you can use Codeply which automatically includes all the necessary libraries for you: Bootstrap 4 on Codeply

Check out the Navbar example using Bootstrap 4.0.0 here:

<nav class="navbar navbar-expand-md navbar-light bg-faded">
    <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>
    <a class="navbar-brand" href="#">Navbar</a>
    <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
        <div class="navbar-nav">
            <a class="nav-item nav-link active" href="#">Home <span class="sr-only">(current)</span></a>
            <a class="nav-item nav-link" href="#">Features</a>
            <a class="nav-item nav-link" href="#">Pricing</a>
            <a class="nav-item nav-link disabled" href="#">Disabled</a>
        </div>
    </div>
</nav>

For more information, visit: Disable responsive navbar in Bootstrap 4

Answer №2

Your mention of their CSS file does not match what is stated on their official website. Please use the following code:

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

Also, your JavaScript file is different from the one listed:

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

For the most up-to-date CDN links, please visit: http://getbootstrap.com/getting-started/

You may have copied that information from an experimental source. (The file name indicates it's in alpha stage, so there may be bugs present)

Answer №3

It appears that you are utilizing the alpha edition of bootstrap, which may contain a defect. We recommend switching to the most recent stable release for optimal performance. For guidance on obtaining the correct css and js files for version 3.3.7, refer to this helpful answer. In case there have been updates to bootstrap since this response was posted, you can access the latest version at http://getbootstrap.com/getting-started/. We trust this information proves useful!

Albert

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Adjust the start and end dates of the Bootstrap datepicker according to the chosen value

I am looking to dynamically set the startDate and endDate of a Bootstrap datepicker based on the value selected in an option form. For example, if I select "Boby" from the options, then the datepicker should be configured with startDate = 2016-10-04 and e ...

What could be the reason for CSS3 PIE failing to work on sub pages when an absolute path is used in the CSS file?

I am struggling with CSS styling and have created the following class: a.greenbutton, input.greenbutton { /*background: url("../image/button.png") repeat-x scroll left top transparent;*/ behavior: url("/css3pie/PIE.php"); -webkit-border-radiu ...

Guide on creating a hover-based side menu

I am looking to enhance the sub-menus like PRODUCT 1, PRODUCT 2, etc. by adding side menus that appear when hovering over them. Can anyone assist with implementing this feature in the code below? Below is the current code snippet: CSS: @import url(http: ...

Using AngularJS for Bootstrap alerts: A step-by-step guide

Hello there! I'm currently working on a project using Django and AngularJS. I'm trying to add Bootstrap alerts after the user submits some information. I want to show alert-success if the submission is successful, and so on. Can anyone help me wi ...

How can the background color of a DIV be altered based on the values of an array's minimum

Basically, I am fetching values from an array using AJAX. The background color will change from green to red based on the "aht_value". Currently, the colors are displaying correctly because I hardcoded the values in the calculation below. However, I want t ...

Is there a way to define the width of an element within the display:flex property in CSS?

Could you please review the following: https://codepen.io/sir-j/pen/dyRVrPb I am encountering an issue where setting the input [type=range] to 500px doesn't seem to make a difference from 100px, 500px, or 800px. This leads me to believe that display ...

Please refrain from altering the color of my flag on hover

I am working with a table that has rows marked with flags. Below is the CSS I have used: <table class="hovered no-border" data-url="@Url.Action("General", "Transport")"> <tbody> <tr> <td><input type="che ...

What role does the sequence play in matrix transitions that involve rotating and translating simultaneously?

Attempting to animate a matrix3d with both rotation and translation concurrently has yielded unexpected results for me. It seems that changing the order of applying rotation and translation produces vastly different outcomes. http://jsfiddle.net/wetlip/2n ...

Looking for a prerequisite for running this script?

Seeking assistance from a skilled Javascript expert. I specialize in template development and utilize a specific script to display my footer link in all the free templates I create. If someone attempts to remove the footer link, their site will be redirec ...

What is the best way to incorporate responsive centered text into my HTML element using Bootstrap 4?

Is there a way to add a responsive centered text element to my <a> element without being affected by the overlay color? Also, is there an alternative method to using an extra overlay div in Bootstrap 4? Check out this link for more details. HTML & ...

Issue with Bootstrap navigation bar extending webpage length beyond desired size

I recently constructed a website using the latest version of Bootstrap, commencing with the cover template. After swapping the navbar with one from the documentation, I noticed that the webpage now extends beyond the screen's length. At the end of the ...

Certain CSS styles that functioned properly during development are not functioning as intended in the build version

When using vue.js, most of my css works well. However, some specific instances do not work as expected. An example of this is in Home.vue: <template> ... </template> <script> ... </script> <style> h1 {font-size:2.6em;font-wei ...

What are some techniques for styling a label element with an empty for attribute using CSS?

Here is what I currently have: <label class="filter-label" for="pv[]181"> ::before white <span class="count">5</span> ::after </label> My goal is to modify the ::after element within that label, but so far my attempts ...

New to jQuery: struggling with click event and CSS... What am I missing here?

I have a very simple question for you: $j(".srch-txt").click(function() { $j(this).css("color:" "#155D97") }); $j is used to avoid conflicts It's quite straightforward: I want to change the color of the .srch-txt element to #155D97 when it is click ...

Initiating a sequential CSS launch using JQuery

Looking for a way to create a dynamic animation using JQuery and .css? This code will rotate letters left, then right, then left, then right again while moving up. $('.envelope').click(function() { $(this).find('.list') .animat ...

Incorporating Bootstrap 4 into NuxtJS

I'm currently integrating Bootstrap 4 (bootstrap-vue) with Nuxt and facing some challenges. I am having trouble utilizing mixins and variables in pages or components, even after including the style-resources-module. Below is a snippet of my nuxt.con ...

What causes WordPress to take precedence over Bootstrap?

Trying to integrate a Bootstrap theme I created into WordPress, but encountering issues. Despite enqueuing all necessary style sheets without errors in the console, WordPress is interfering with the layout. The rounded circles with images are appearing s ...

Display/conceal within a jQuery fixed navigation bar (center-aligned)

I am facing challenges with creating a sticky menu that shows/hides with a click button. Considering abandoning the show/hide feature altogether and rebuilding it from scratch in the future. Two major problems I have identified: How can I make the sho ...

A guide to adjusting the width without affecting the td element

Currently, I am facing a challenge while coding in HTML. I am trying to create a table with a header (time range) that fits on a single line without affecting the width of the td elements. Below is the code snippet: <table style="border:1px solid #8c ...

Avoiding the fontawesome icon within a Bootstrap button from being the only item to wrap to the next line

Explore a straightforward Bootstrap 4 button featuring a fontawesome icon. If this button is situated in a container that happens to be slightly smaller than its default width, the icon will shift to the next line. body { padding: 20px; } <link ...