Reputation: 71
Is it possible to make a flex element with item display as row but 2 items display as column?
I want to display like this
.nav{
height: 44px;
border: 1px solid #000;
display: flex;
flex-direction: row;
}
.item{
text-decoration: none;
border: 1px solid #000;
width: 60px;
text-align: center;
}
.item.inline{
background: lightcoral;
height: 20px;
}
**HTML:**
<div class="nav">
<a href="#" class="item">1</a>
<a href="#" class="item">2</a>
<a href="#" class="item">3</a>
<a href="#" class="item inline">4</a>
<a href="#" class="item inline">5</a>
<a href="#" class="item">6</a>
</div>
Upvotes: 2
Views: 68
Reputation: 18393
The wrapped column which looks like a row:
.nav, .item {
box-sizing: border-box;
border: 1px solid #000;
}
.nav {
display: flex;
flex-flow: column wrap;
align-content: flex-start;
height: 44px;
}
.item {
width: 60px;
height: 100%;
text-align: center;
text-decoration: none;
}
.item.inline {
background: lightcoral;
height: 50%;
}
<div class="nav">
<a href="#" class="item">1</a>
<a href="#" class="item">2</a>
<a href="#" class="item">3</a>
<a href="#" class="item inline">4</a>
<a href="#" class="item inline">5</a>
<a href="#" class="item">6</a>
</div>
Upvotes: 2