When adding elements on top of a card, the snippet below demonstrates the placement:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="container mt-4">
<div class="clearfix">
<span class="float-right">right</span>
<span>left</span>
</div>
<div class="card">
<div class="card-header clearfix">
<span class="float-right">right</span>
<span>left</span>
</div>
<div class="card-body">
Sequi ad provident non. Et ea beatae ipsum sint. Quas omnis libero similique maxime perferendis pariatur aut ut. Alias quo et modi eaque. Et doloremque minima adipisci error quia rem.
Minima quibusdam sunt sint. Id perspiciatis corporis rerum sapiente ullam velit. Ratione ipsam ut voluptates iure et consequatur. Consequuntur nostrum impedit nesciunt ipsa.
</div>
</div>
</div>
The goal is to have these elements aligned with the same indentation as the card content, without using custom CSS. The use of p-3
, px-3
, p-4
, and px-4
resulted in slightly different indentations.
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="container mt-4">
<div class="px-4 clearfix">
<span class="float-right">right</span>
<span>left</span>
</div>
<div class="card">
<div class="card-header clearfix">
<span class="float-right">right</span>
<span>left</span>
</div>
<div class="card-body">
Sequi ad provident non. Et ea beatae ipsum sint. Quas omnis libero similique maxime perferendis pariatur aut ut. Alias quo et modi eaque. Et doloremque minima adipisci error quia rem.
Minima quibusdam sunt sint. Id perspiciatis corporis rerum sapiente ullam velit. Ratione ipsam ut voluptates iure et consequatur. Consequuntur nostrum impedit nesciunt ipsa.
</div>
</div>
</div>
Initially considering placing the elements within a card itself, but that would require using custom CSS to make the card body transparent.
Is there a component or layout utility available that matches the padding of the card component exactly?