When creating cards, I encounter a challenging issue. I am struggling to fill the background-color of the entire box content as I am new to HTML and CSS and unsure how to achieve this. Below are my codes.
.box-container1 {
display: flex;
justify-content: center;
}
.box {
background-color: white;
border: 1px solid #3AD6B1;
box-shadow: 0 3px 6px #ddd;
padding: 0;
margin: 8px;
width: 420px;
}
.box .box-header {
background-color: #3AD6B1;
width: 100%;
padding: 0;
margin: 0;
display: flex;
height: 4rem;
}
.box .box-img {
padding: 0.5rem;
text-align: center;
align-items: center;
vertical-align: middle;
}
.box .box-content {
margin: 0.5rem;
background-color: rgba(0, 0, 0, 0.4);
text-align: left;
}
.bg-green {
background-color: #3AD6B1!important;
}
.bg-green01 {
background-color: #1CA484;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<div class="box-container1">
<div class="box">
<div class="box-header">
<div class="bg-green01 text-white p-2 font-weight-bold">
<div class="h3 m-0">1</div>
</div>
<div class="font-weight-bold p-2 text-left">Box 1</div>
</div>
<div class="box-img"><img src="assets/img/Team-presentation.png"></div>
<div class="bg-green01 w-100" style="height: 1rem"></div>
<div class="box-content">
<label>This is sample text. This is sample text. This is sample text. This is sample text. This is sample text. This is sample text. This is sample text. This is sample text. This is sample text. This is sample text. This is sample text. This is sample text...</label>
</div>
</div>
<div class="box">
<div class="box-header">
<div class="bg-green01 text-white p-2 font-weight-bold">
<div class="h3 m-0">2</div>
</div>
<div class="font-weight-bold p-2 text-left">Box 2</div>
</div>
<div class="box-img"><img src="assets/img/Coding.png"></div>
<div class="bg-green01 w-100" style="height: 1rem"></div>
<div class="box-content">
<label>This is sample text. This is sample text. This is sample text. This is sample text. This is sample text. This is sample text. This is sample text. This is sample text.</label>
</div>
</div>
</div>
If you test my code, you will notice that the background-color doesn't fully fill in for box2. My goal is to have the card content completely filled with the background-color. I am seeking a solution to resolve this.