I am currently working on a dropdown feature using Bootstrap 4. To achieve the desired layout, I have placed the dropdown-toggle button and dropdown-menu within a div element with the class "container". My goal is for both the dropdown toggle and dropdown menu to span the full width of their parent element. Here's the code snippet I have written so far:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<body>
<div class="container">
<button class="dropdown-toggle btn-block" data-toggle="dropdown">
Dropdown
</button>
<div class="dropdown-menu">
<a href="" class="dropdown-item">One</a>
<a href="" class="dropdown-item">Two</a>
<a href="" class="dropdown-item">Three</a>
<a href="" class="dropdown-item">Four</a>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
While the dropdown-toggle button successfully stretches to the full width of its parent div, I encountered an issue when clicking on it - the dropdown-menu does not expand to match the parent's width. I aim for the dropdown-menu to have the same width as its parent container. I have attempted using the width:inherit; property, but it did not produce the desired outcome.