I am novice. I am using bootstrap-4 for making a website. In which there must be a text scrolling in top and after that menu along with logo and name.
I am using two container for the same. 1st for Text scrolling in top and 2nd for menu bar. In 2nd container I am using navbar. But Navbar is not getting same width as its parent container.
I wish both container must have same width along with nav-bar
My Codes:
<header>
<!-- top header for scrolling text marque -->
<div class="container">
<div class="row">
<div style="background-color: black; border-color: orange; width: 100%; height: 2rem" >
</div>
</div>
</div>
<!-- for menu -->
<div class="container" style="border: 1px; border-color:red;border-style: double;height: 4rem;">
<nav class="navbar navbar-expand-md" style="background-color:rgba(255, 255, 128);border-style: double;border-color: red;">
<a class="navbar-brand" href="#">Navbar</a>
</nav>
</div>
</header>
2
Answers
Both the
containers
have the same width. The only catch here is that you do not have adiv
withcol
class
. If you add adiv
withcol-md-12
inside therow
, it will match the width of the secondcontainer
, like:The other solution you can try is to add a
p-0
class with the secondcontainer
, like:https://stackoverflow.com/users/8149710/haseeb-hassy
The answer is correct and I have also tried this because the same design makes many ways to make it.