Responsive Bootstrap 4 navbar dropdown-items display as nav-items












0















Hello and thanks in advance for the help. Here's a link to the site in question: caulfield.co/test/originals.html



I'm attempting to create a responsive navbar in which the current dropdown-items appear as the standard nav-items after collapse.



See this image:



Dropdown displaying correctly on desktop view



The dropdown-items are displaying as intended on desktop. On mobile, however, the separate dropdown is unnecessary. Here is how it displays with Bootstrap 4 out of the box:



Minimized Mobile navbar with unnecessary dropdown



Does anyone know of a convenient or custom solution to remove the dropdown once the navbar-collapse is in use on mobile etc such that the dropdown-items appear just like the navbar-items? Ideally, the "More" nav-link would display:none and the nav-items would continue from "Contact" to "Works On Display" seamlessly.



HTML:



<nav id="navHome" class="navbar navbar-expand-lg navbar-light sticky-top">
<div class="container-fluid max-width-940">
<a class="navbar-brand" href="index.html">
<img src="images/mb.svg" alt="Margaret Biggs" width="220px"/>
</a>
<button class="navbar-toggler togglerNoBorder" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse backgroundWhite" id="navbarNavDropdown">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="bio.html">Bio <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="originals.html">Originals</a>
</li>
<li class="nav-item">
<a class="nav-link" href="exhibition.html">Exhibition</a>
</li>
<li class="nav-item">
<a class="nav-link" href="prints.html">Prints</a>
</li>
<li class="nav-item">
<a class="nav-link" href="professionals.html">For Professionals</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contact.html">Contact</a>
</li>
<li class="nav-item dropdown navDropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
More
</a>
<div class="dropdown-menu navDropdown" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="works-on-display.html">Works on Display</a>
<a class="dropdown-item" href="poetry.html">Poetry</a>
<a class="dropdown-item" href="commissions.html">Commissions</a>
<a class="dropdown-item" href="blog.html">Blog</a>
</div>
</li>
</ul>
</div>
</div>
</nav>


CSS:



.navbar-right {
float:right;
}

.togglerNoBorder{
border: 0px solid transparent;
}

.nav940{
max-width:940px;
margin:0 auto;
}

#navHome {
color:rgb(34, 34, 34);
font-size:13px;
font-weight:400;
line-height:16px;
text-transform:uppercase;
background-color:white;
height:60px;
box-shadow: 0 0 18px -4px #000;
}

#navHome a{
color:rgb(34, 34, 34);
}

#navHome a:hover{
color:#165fa5;
}

.navDropdown {
font-size:13px;
}

.navDropdown a:hover {
background-color:white;
}

.backgroundWhite{
background-color:white;
}

.nav-item{
padding-left:10px;
}

.dropdown-item {
padding-top:10px;
}

.navbar-brand {
margin-bottom:3px;
}

.dropdown-menu {
top:45px;
}









share|improve this question

























  • please accept the answer so other know the question has been resolved

    – Zim
    Dec 2 '18 at 14:25
















0















Hello and thanks in advance for the help. Here's a link to the site in question: caulfield.co/test/originals.html



I'm attempting to create a responsive navbar in which the current dropdown-items appear as the standard nav-items after collapse.



See this image:



Dropdown displaying correctly on desktop view



The dropdown-items are displaying as intended on desktop. On mobile, however, the separate dropdown is unnecessary. Here is how it displays with Bootstrap 4 out of the box:



Minimized Mobile navbar with unnecessary dropdown



Does anyone know of a convenient or custom solution to remove the dropdown once the navbar-collapse is in use on mobile etc such that the dropdown-items appear just like the navbar-items? Ideally, the "More" nav-link would display:none and the nav-items would continue from "Contact" to "Works On Display" seamlessly.



HTML:



<nav id="navHome" class="navbar navbar-expand-lg navbar-light sticky-top">
<div class="container-fluid max-width-940">
<a class="navbar-brand" href="index.html">
<img src="images/mb.svg" alt="Margaret Biggs" width="220px"/>
</a>
<button class="navbar-toggler togglerNoBorder" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse backgroundWhite" id="navbarNavDropdown">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="bio.html">Bio <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="originals.html">Originals</a>
</li>
<li class="nav-item">
<a class="nav-link" href="exhibition.html">Exhibition</a>
</li>
<li class="nav-item">
<a class="nav-link" href="prints.html">Prints</a>
</li>
<li class="nav-item">
<a class="nav-link" href="professionals.html">For Professionals</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contact.html">Contact</a>
</li>
<li class="nav-item dropdown navDropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
More
</a>
<div class="dropdown-menu navDropdown" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="works-on-display.html">Works on Display</a>
<a class="dropdown-item" href="poetry.html">Poetry</a>
<a class="dropdown-item" href="commissions.html">Commissions</a>
<a class="dropdown-item" href="blog.html">Blog</a>
</div>
</li>
</ul>
</div>
</div>
</nav>


CSS:



.navbar-right {
float:right;
}

.togglerNoBorder{
border: 0px solid transparent;
}

.nav940{
max-width:940px;
margin:0 auto;
}

#navHome {
color:rgb(34, 34, 34);
font-size:13px;
font-weight:400;
line-height:16px;
text-transform:uppercase;
background-color:white;
height:60px;
box-shadow: 0 0 18px -4px #000;
}

#navHome a{
color:rgb(34, 34, 34);
}

#navHome a:hover{
color:#165fa5;
}

.navDropdown {
font-size:13px;
}

.navDropdown a:hover {
background-color:white;
}

.backgroundWhite{
background-color:white;
}

.nav-item{
padding-left:10px;
}

.dropdown-item {
padding-top:10px;
}

.navbar-brand {
margin-bottom:3px;
}

.dropdown-menu {
top:45px;
}









share|improve this question

























  • please accept the answer so other know the question has been resolved

    – Zim
    Dec 2 '18 at 14:25














0












0








0








Hello and thanks in advance for the help. Here's a link to the site in question: caulfield.co/test/originals.html



I'm attempting to create a responsive navbar in which the current dropdown-items appear as the standard nav-items after collapse.



See this image:



Dropdown displaying correctly on desktop view



The dropdown-items are displaying as intended on desktop. On mobile, however, the separate dropdown is unnecessary. Here is how it displays with Bootstrap 4 out of the box:



Minimized Mobile navbar with unnecessary dropdown



Does anyone know of a convenient or custom solution to remove the dropdown once the navbar-collapse is in use on mobile etc such that the dropdown-items appear just like the navbar-items? Ideally, the "More" nav-link would display:none and the nav-items would continue from "Contact" to "Works On Display" seamlessly.



HTML:



<nav id="navHome" class="navbar navbar-expand-lg navbar-light sticky-top">
<div class="container-fluid max-width-940">
<a class="navbar-brand" href="index.html">
<img src="images/mb.svg" alt="Margaret Biggs" width="220px"/>
</a>
<button class="navbar-toggler togglerNoBorder" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse backgroundWhite" id="navbarNavDropdown">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="bio.html">Bio <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="originals.html">Originals</a>
</li>
<li class="nav-item">
<a class="nav-link" href="exhibition.html">Exhibition</a>
</li>
<li class="nav-item">
<a class="nav-link" href="prints.html">Prints</a>
</li>
<li class="nav-item">
<a class="nav-link" href="professionals.html">For Professionals</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contact.html">Contact</a>
</li>
<li class="nav-item dropdown navDropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
More
</a>
<div class="dropdown-menu navDropdown" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="works-on-display.html">Works on Display</a>
<a class="dropdown-item" href="poetry.html">Poetry</a>
<a class="dropdown-item" href="commissions.html">Commissions</a>
<a class="dropdown-item" href="blog.html">Blog</a>
</div>
</li>
</ul>
</div>
</div>
</nav>


CSS:



.navbar-right {
float:right;
}

.togglerNoBorder{
border: 0px solid transparent;
}

.nav940{
max-width:940px;
margin:0 auto;
}

#navHome {
color:rgb(34, 34, 34);
font-size:13px;
font-weight:400;
line-height:16px;
text-transform:uppercase;
background-color:white;
height:60px;
box-shadow: 0 0 18px -4px #000;
}

#navHome a{
color:rgb(34, 34, 34);
}

#navHome a:hover{
color:#165fa5;
}

.navDropdown {
font-size:13px;
}

.navDropdown a:hover {
background-color:white;
}

.backgroundWhite{
background-color:white;
}

.nav-item{
padding-left:10px;
}

.dropdown-item {
padding-top:10px;
}

.navbar-brand {
margin-bottom:3px;
}

.dropdown-menu {
top:45px;
}









share|improve this question
















Hello and thanks in advance for the help. Here's a link to the site in question: caulfield.co/test/originals.html



I'm attempting to create a responsive navbar in which the current dropdown-items appear as the standard nav-items after collapse.



See this image:



Dropdown displaying correctly on desktop view



The dropdown-items are displaying as intended on desktop. On mobile, however, the separate dropdown is unnecessary. Here is how it displays with Bootstrap 4 out of the box:



Minimized Mobile navbar with unnecessary dropdown



Does anyone know of a convenient or custom solution to remove the dropdown once the navbar-collapse is in use on mobile etc such that the dropdown-items appear just like the navbar-items? Ideally, the "More" nav-link would display:none and the nav-items would continue from "Contact" to "Works On Display" seamlessly.



HTML:



<nav id="navHome" class="navbar navbar-expand-lg navbar-light sticky-top">
<div class="container-fluid max-width-940">
<a class="navbar-brand" href="index.html">
<img src="images/mb.svg" alt="Margaret Biggs" width="220px"/>
</a>
<button class="navbar-toggler togglerNoBorder" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse backgroundWhite" id="navbarNavDropdown">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="bio.html">Bio <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="originals.html">Originals</a>
</li>
<li class="nav-item">
<a class="nav-link" href="exhibition.html">Exhibition</a>
</li>
<li class="nav-item">
<a class="nav-link" href="prints.html">Prints</a>
</li>
<li class="nav-item">
<a class="nav-link" href="professionals.html">For Professionals</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contact.html">Contact</a>
</li>
<li class="nav-item dropdown navDropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
More
</a>
<div class="dropdown-menu navDropdown" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="works-on-display.html">Works on Display</a>
<a class="dropdown-item" href="poetry.html">Poetry</a>
<a class="dropdown-item" href="commissions.html">Commissions</a>
<a class="dropdown-item" href="blog.html">Blog</a>
</div>
</li>
</ul>
</div>
</div>
</nav>


CSS:



.navbar-right {
float:right;
}

.togglerNoBorder{
border: 0px solid transparent;
}

.nav940{
max-width:940px;
margin:0 auto;
}

#navHome {
color:rgb(34, 34, 34);
font-size:13px;
font-weight:400;
line-height:16px;
text-transform:uppercase;
background-color:white;
height:60px;
box-shadow: 0 0 18px -4px #000;
}

#navHome a{
color:rgb(34, 34, 34);
}

#navHome a:hover{
color:#165fa5;
}

.navDropdown {
font-size:13px;
}

.navDropdown a:hover {
background-color:white;
}

.backgroundWhite{
background-color:white;
}

.nav-item{
padding-left:10px;
}

.dropdown-item {
padding-top:10px;
}

.navbar-brand {
margin-bottom:3px;
}

.dropdown-menu {
top:45px;
}






drop-down-menu bootstrap-4 navbar responsive






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 2:30







willBeing

















asked Nov 24 '18 at 0:01









willBeingwillBeing

436




436













  • please accept the answer so other know the question has been resolved

    – Zim
    Dec 2 '18 at 14:25



















  • please accept the answer so other know the question has been resolved

    – Zim
    Dec 2 '18 at 14:25

















please accept the answer so other know the question has been resolved

– Zim
Dec 2 '18 at 14:25





please accept the answer so other know the question has been resolved

– Zim
Dec 2 '18 at 14:25












1 Answer
1






active

oldest

votes


















0














Use a @media query for mobile (<992px) to show the dropdown-menu as normal nav-links...



@media (max-width: 992px) {
.dropdown-toggle {
display: none;
}

.dropdown-menu {
display: block;
position: relative;
border-width: 0;
padding: 0;
margin: 0;
}

.dropdown-item {
padding: .5rem 0rem;
color: rgba(0,0,0,.5);
}
}


https://www.codeply.com/go/lAAQOwhAx0






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454056%2fresponsive-bootstrap-4-navbar-dropdown-items-display-as-nav-items%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Use a @media query for mobile (<992px) to show the dropdown-menu as normal nav-links...



    @media (max-width: 992px) {
    .dropdown-toggle {
    display: none;
    }

    .dropdown-menu {
    display: block;
    position: relative;
    border-width: 0;
    padding: 0;
    margin: 0;
    }

    .dropdown-item {
    padding: .5rem 0rem;
    color: rgba(0,0,0,.5);
    }
    }


    https://www.codeply.com/go/lAAQOwhAx0






    share|improve this answer




























      0














      Use a @media query for mobile (<992px) to show the dropdown-menu as normal nav-links...



      @media (max-width: 992px) {
      .dropdown-toggle {
      display: none;
      }

      .dropdown-menu {
      display: block;
      position: relative;
      border-width: 0;
      padding: 0;
      margin: 0;
      }

      .dropdown-item {
      padding: .5rem 0rem;
      color: rgba(0,0,0,.5);
      }
      }


      https://www.codeply.com/go/lAAQOwhAx0






      share|improve this answer


























        0












        0








        0







        Use a @media query for mobile (<992px) to show the dropdown-menu as normal nav-links...



        @media (max-width: 992px) {
        .dropdown-toggle {
        display: none;
        }

        .dropdown-menu {
        display: block;
        position: relative;
        border-width: 0;
        padding: 0;
        margin: 0;
        }

        .dropdown-item {
        padding: .5rem 0rem;
        color: rgba(0,0,0,.5);
        }
        }


        https://www.codeply.com/go/lAAQOwhAx0






        share|improve this answer













        Use a @media query for mobile (<992px) to show the dropdown-menu as normal nav-links...



        @media (max-width: 992px) {
        .dropdown-toggle {
        display: none;
        }

        .dropdown-menu {
        display: block;
        position: relative;
        border-width: 0;
        padding: 0;
        margin: 0;
        }

        .dropdown-item {
        padding: .5rem 0rem;
        color: rgba(0,0,0,.5);
        }
        }


        https://www.codeply.com/go/lAAQOwhAx0







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 24 '18 at 0:28









        ZimZim

        191k48398386




        191k48398386
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454056%2fresponsive-bootstrap-4-navbar-dropdown-items-display-as-nav-items%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Wiesbaden

            Marschland

            Dieringhausen