Reputation:
As you know, bootstrap is running according to the class value of the parents for (flex row/column).
.bd-highlight {
background-color: rgba(86, 61, 124, .15);
border: 1px solid rgba(86, 61, 124, .15);
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css" rel="stylesheet" />
<div class="d-flex flex-row bd-highlight mb-3">
<div class="p-2 bd-highlight">Flex item 1</div>
<div class="p-2 bd-highlight">Flex item 2</div>
<div class="p-2 bd-highlight">Flex item 3</div>
</div>
<div class="d-flex flex-column bd-highlight mb-3">
<div class="p-2 bd-highlight">Flex item 1</div>
<div class="p-2 bd-highlight">Flex item 2</div>
<div class="p-2 bd-highlight">Flex item 3</div>
</div>
I want to use an exception in row: Like at self-column
<div class="d-flex flex-row bd-highlight mb-3">
<div class="p-2 bd-highlight">Flex item 1</div>
<div class="p-2 bd-highlight">Flex item 2</div>
<div class="p-2 bd-highlight self-column">Flex item 3</div>
</div>
I produced a solution like this but not work:
.bd-highlight {
background-color: rgba(86, 61, 124, .15);
border: 1px solid rgba(86, 61, 124, .15);
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css" rel="stylesheet" />
<div class="d-flex flex-row bd-highlight mb-3">
<div class="p-2 bd-highlight">Flex item 1</div>
<div class="p-2 bd-highlight">Flex item 2</div>
<div class="p-2 bd-highlight w-100">Flex item 3</div>
</div>
I do not know what I'm doing, but is there a special and right class I can add to my library?
Upvotes: 7
Views: 16680
Reputation: 273625
You need to activate the wrap by adding flex-wrap
:
.bd-highlight {
background-color: rgba(86, 61, 124, .15);
border: 1px solid rgba(86, 61, 124, .15);
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/css/bootstrap.min.css" rel="stylesheet" />
<div class="d-flex flex-row flex-wrap bd-highlight mb-3">
<div class="p-2 bd-highlight">Flex item 1</div>
<div class="p-2 bd-highlight">Flex item 2</div>
<div class="p-2 bd-highlight w-100">Flex item 3</div>
</div>
Upvotes: 5