0

I'm building a small portfolio site and I'm using bootstrap for the navigation bar, I modified a bit with things such as a different background and fonts. I'm not sure what is missing exactly, but the last item, called "language", which is a dropdown, simply doesn't seem to show up when I change the window size.

I made a codepen with the relevant code in it, sorry for any obvious mistake as I've just started out using it seriously:

https://codepen.io/bladeranner5005/pen/ExwpMpq

HTML:

<!doctype html>
<html lang="it">
<head>
    <!--Required meta tags-->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!--Font links-->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@300;400&family=Libre+Franklin:wght@800&display=swap" rel="stylesheet">

    <!--Bootstrap CSS-->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">

    <!--My Css-->

    <!--Icons links-->

    <!--Custom css-->
    <link href="Index-css.css" rel="stylesheet">


    <title>Andrea D'Angelo-portfolio</title>
</head>

<body>

<!-- NAVBAR ----------------------------------------------------------------------------------------------------------->
<!--Modified bootstrap NAVBAR, with different colors and positioning when in desktop----------------------------------->

<nav class="navbar navbar-expand-lg fixed-top navbar-dark navbar-black">



    <a class="navbar-brand" href="#"></a>
    <button class="navbar-toggler" 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>
    <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
        <div class="navbar-nav mx-auto">
            <a class="nav-item nav-link active nav-link-custom-1 nav-item-spacing" href="#">Home</a>
            <a class="nav-item nav-link nav-link-custom-1 nav-item-spacing" href="#">Curriculum</a>
            <a class="nav-item nav-link nav-link-custom-1 nav-item-spacing" href="#">Portfolio</a>
            <a class="nav-item nav-link nav-link-custom-1 nav-item-spacing" href="#">Contatti</a>

            <!--Codice per il dropdown da: https://stackoverflow.com/questions/17904862/bootstrap-position-of-dropdown-menu-relative-to-navbar-item-->
            <div class="collapse navbar-collapse" id="navbarSupportedContent">
                <ul class="navbar-nav mr-auto">
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle nav-link-custom-2 nav-item-spacing" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            Language
                        </a>
                        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                            <a class="dropdown-item nav-link-custom-2" href="#">
                                <span></span>
                                Ita</a>
                            <a class="dropdown-item nav-link-custom-2" href="#">
                                <span></span>
                                Eng</a>
                        </div>
                    </li>
        </div>

            <!--Dropdown item end-->

    </div>
    </div>
</nav>

<!--Main tag----------------------------------------------------------------------------------------------------------->

<main>

<!--HOME-Logo animation------------------------------------------------------------------------------------------------>



</main>

<!-- Javascript for Bootstrap --------------------->
<!-- Optional JavaScript; choose one of the two! -->

<!-- Option 1: Bootstrap Bundle with Popper -->
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<!-- Javascript for Bootstrap END------------------>

</body>
</html>

CSS:

/*ESSENTIAL ----------------------------------------------------------------------------------------------------------*/
body {
    padding-top: 70px;
} /*Per non far coprire contenuti dal navbar, source: https://stackoverflow.com/questions/11124777/twitter-bootstrap-navbar-fixed-top-overlapping-site --*/

html {
    scroll-behavior: smooth;
}

/*FONTS --------------------------------------------------------------------------------------------------------------*/

/*Tags from google fonts

Josefin sans light:

font-family: 'Josefin Sans', sans-serif;
font-weight: 300;

Josefin sans regular:

font-family: 'Josefin Sans', sans-serif;
font-weight: 400;

Libre Franklin
font-family: 'Libre Franklin', sans-serif;
font-weight: 800;
*/



/*NAVBAR -------------------------------------------------------------------------------------------------------------*/

/*Structure --*/

.nav-item-spacing {
    margin-left:30px;
    margin-right:30px;
}

/*Colors --*/

.navbar-black {
    background: black;
}

.nav-link-custom-1 {
    font-family: 'Libre Franklin', sans-serif;
    font-weight: 800;
}

.nav-link-custom-2 {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 400;
}
  • you need to remove the div and ul to make their javascript code can select it and make it in mobile as the make it to be created dynamically so make sure to follow the rules of righting it and good luck – AbdelRhman Khalil Jan 08 '22 at 01:53

1 Answers1

1

Remove:

<div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav mr-auto">

from before the "language" dropdown in your html (also remove the </div> ) There doesn't seem to be a purpose of having that again.

John
  • 5,132
  • 1
  • 6
  • 17