I'm newbie to css and bootstrap and can not figure out how to solve this. Any help are welcome.
I have two problems with my code.
1) When I click on the 'Welcome, User' menu in small screens (mobile), the dropdown menu opens inside the navigation bar, distorting the bar and changing its height. I want it to behave in the same way as on larger screens (desktops, for example). When I click, I want it to open the menu items without changing the navigation bar, in front of the navigation bar but not inside.
2) Another problem: even on larger screens, I can not see the menu items completely. Some of the text of the items is hidden at the edge of the screen. I would like the menu to appear completely on the screen, no matter if it is desktop or mobile.
To make it clear, I record a very small video demonstrating the problem: https://puu.sh/Bq34w/ac56908be0.mp4
The complete code: https://jsfiddle.net/fredslz/0v7qwjdm/12/
<!doctype html>
<html lang="en">
<body class="text-center">
<nav class="navbar navbar-expand-md navbar-light fixed-top" style="background-color: #FFFFFF;">
<button class="navbar-toggler navbar-nav mr-auto" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand mx-auto" href="#">My Brand</a>
<ul class="nav navbar-nav ml-md--auto">
<li class="dropdown">
<a href="#" class="nav-link dropdown-toggle" id="navbarDropdown" data-toggle="dropdown" aria-expanded="false">
Welcome, User <b class="caret"></b>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
</ul>
</nav>
</body>
</html>
And the CSS:
.navbar {
-webkit-box-shadow: 0 8px 6px -6px #999;
-moz-box-shadow: 0 8px 6px -6px #999;
box-shadow: 0 8px 6px -6px #999;
}