Here is my CSS and HTML for that section:
@media (min-width:544px) {
.navbar-toggler {
float: right;
display: inline-block;
margin-top: 5px;
margin-bottom: 25px;
padding: 10px;
border: none;
}
.nav-responsive li {
display: block;
}
.nav-item {
list-style: none;
}
.navbar-nav {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
padding-left: 0;
margin-bottom: 0;
list-style: none;
}
}
@media (max-width: 991px) and (orientation: landscape)
{
.navbar-expand-lg .navbar-nav {
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row; /* This will override the flex-direction: column */
}
}
<button class="navbar-toggler hidden-md-up" type="button" data-toggle="collapse" data-target="#menu">
☰</button>
<div class="collapse navbar-expand-lg navbar-toggleable-sm" id="menu">
<ul class="navbar-nav nav-responsive pull-md-right">
<li class="nav-item"><a href="https://christymlittle.com/" class="nav-link" title="">Home</a></li>
<li class="nav-item"><a href="about" class="nav-link" title="">About</a></li>
<li class="nav-item"><a href="work" class="nav-link" title="">Work</a>
</li>
<li class="nav-item"><a href="contact" class="nav-link" title="">Contact</a></li>
</ul>
Update: This site won't let me insert a screenshot and I don't have this on a live site at the moment. The simulator will show the menu as vertical on landscape view on smartphones, but the top link sticks out more to the left than the other links. This continues on the larger screens, despite the override in the large breakpoint.
You might want to replace the
navbarof your<ul>element withnavbar-nav, and add thenavbar-expand-lgclass to your<div>.The
navbar-navclass creates the vertical stack, andnavbar-expand-lgfrom the parent element ensures it displays horizontally on a large screen.See the following snippet:
From the console showing Bootstrap styles:
Small screen:
Large screen: