Here is my problem. I have a navbar whose menus/links are located in the center. on the left is the logo, on the right are cta buttons and icons
If it overflows/wrap, the center column should put it on the next line at full width and the left and right column stays on top as 2 columns.
Given this sample code:
* {
box-sizing: border-box;
}
body, html {
margin: 0;
padding: 0;
}
.content {
display: flex;
flex-wrap: wrap;
}
.a, .b, .c{
border: 1px solid black;
flex: 1;
padding: 10px;
}
.b, .c {
flex-wrap: wrap-reverse;
}
<div class="content">
<div class="a">LogoAndStuff</div>
<div class="b">Link1,Link2,Link3,Link4</div>
<div class="c">Buttons,Icons</div>
</div>
Fiddle: https://jsfiddle.net/3erodmv7/3/
Menu items/links has dynamic width so I rely on overflow/wrapping instead of fixed width and media queries.
Not overflow:
--------------------------------------
| Logo | Link1,Link2,Link3 | Buttons |
--------------------------------------
overflow:
------------------------------------
| Logo | Buttons |
------------------------------------
| Link1,Link2,Link3 |
------------------------------------
With float you can approximate this but you will have less flexibility to control width like you are doing with the flex
property
* {
box-sizing:border-box;
}
body,
html {
margin: 0;
padding: 0;
}
.a,
.c {
border: 1px solid black;
padding: 10px;
width:33%;
min-width:110px;
}
.a {
float:left;
}
.c {
float:right;
}
.b {
border: 1px solid black;
}
.b span{
display:inline-block;
padding: 10px;
}
<div class="content">
<div class="a">LogoAndStuff</div>
<div class="c">Buttons,Icons</div>
<div class="b"><span>Link1,Link2,Link3,Link4</span></div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With