I am trying to have an HTML card with a title, an image on the right and a bullet list on the left. However, the bullet list goes outside the card. How can I make the card's div adapt to the length of its content?
Here is the code:
.card {
/* Add shadows to create the "card" effect */
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
transition: 0.3s;
padding: 20px;
width: 100%;
}
/* On mouse-over, add a deeper shadow */
.card:hover {
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}
.card_excerpt {
float: right;
width: 50%;
}
.card_image {
width: 40%;
}
<div class="card">
<h3><b>CARD TITLE</b></h3>
<div class="card_excerpt">
<ul>
<li> Bullet 1</li>
<li> Bullet 2</li>
<li> Bullet 3</li>
<li> Bullet 4</li>
<li> Bullet 5</li>
<li> Bullet 6</li>
<li> Bullet 7</li>
</ul>
</div>
<div class="card_image"> <img src="some img" /> </div>
</div>