I was making a rounded div , with an image (already rounded) with text on the right side.
The text keeps overflowing the div . Also , the text is starting from the center of the div . I want it to be close to the image .
As you can see the picture : the image is not close to the edge , and the text is far from the image .
This is what I tried to do :
<div class="container2">
<div class="image-container">
<img src="test.svg" alt="Image" />
</div>
<div class="text-container">
<p>Text.</p>
</div>
</div>
.container2 {
padding-top:20px;
height: 140px;
background: #FFFFFF;
box-shadow: 3px 3px 7px #00000029;
border-radius: 94px;
opacity: 1;
display: flex;
}
.image-container {
flex: 1;
overflow: hidden;
}
.image-container img {
padding: 4px;
width: 60%;
height: 100%;
}
.text-container {
flex: 1.5;
padding: 10px;
overflow: hidden;
word-wrap: break-word;
}
2
Answers
This is an example of the design your going for:
This is how your code should be structured, it’s using flexbox and it’ll help make sure your code is neatly organized and that you have easy access to arrange and move around elements. Also, replace the image with yours. To stop overflowing, you might want to limit the text input, if you want to use it for users to input, you’ll need to use javascript or some other techniques to limit the text input.