Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No wrap in boostrap row

I want to make header contains logo and menu.

I maked row and two columns. I used booеstrap classes. When I resize window to smaller, menu jumps under logo (look at my picture). In this moment when screen width is small and menu jumps under logo I wanna make collapse menu, but I dont know how to write it to code:

enter image description here

My HTML code:

<div class="mycontainer container-fluid">
<div class="container">
    <div class="row">
        <div class="logo col-md-4">
        <a href = "/" class = "logo"><img src="/bendikon/wp-content/themes/bendikon/images/logo.png" alt="banner"></a>    
        </div>
        <div class="header-menu col-md-8">
        <?php if ( has_nav_menu( 'primary-menu' ) ) { ?>
        <?php wp_nav_menu( array( 'theme_location' => 'primary-menu') ); ?>
        <?php } else { ?>
              <ul class="sf-menu">
                <li><a href="/">Home</a></li>
                <li><a href="/?page_id=2">Sample Page</a></li>
                <li><a href="/?p=1">Sample post</a></li>
              </ul>
            <?php } ?>
        </div>
        </div>
    </div>
</div>

like image 721
Martin Benda Avatar asked Mar 24 '15 20:03

Martin Benda


People also ask

What is wrap Bootstrap?

The bootstrap wrap is used to cover or wrap the flex items in a flex container.It has main three classes which is . flex-wrap, . flex-nowrap, . flex-wrap-reverse.

What is D flex in Bootstrap?

The Flexible Box Layout Module in bootstrap is used for designing the flexible and responsive layout structure. It is used in Bootstrap 4. The d-flex class is used to create a simple flexbox container.

How do I remove the gutter space in Bootstrap?

The gutters between columns in our predefined grid classes can be removed with .g-0 . This removes the negative margin s from .row and the horizontal padding from all immediate children columns.

What is Col SM 4 in Bootstrap?

col-sm-4 are available for quickly making grid layouts. Columns create gutters (gaps between column content) via padding. That padding is offset in rows for the first and last column via negative margin on .


2 Answers

you can use flex-nowrap like this:

<div class="row flex-nowrap">
    <div class="col"></div>
    <div class="col"></div>
</div>

check it here: Bootstrap 4.0 flex-nowrap

like image 145
MrMaavin Avatar answered Sep 22 '22 11:09

MrMaavin


try with the class col-xs-8 and col-xs-4 instead of col-md-8 and col-md-4. Is normal that your columns are displayed as a plain blocks if you don't tell them how behave on xs size.

Also you might want to add the class img-responsive to your logo img tag to limit the maximum width to 100% of the containing column.

like image 39
Dax Avatar answered Sep 22 '22 11:09

Dax