I have a multi-line text that I need to adapt to a div. For example:
https://i.stack.imgur.com/mtZmf.png
Is there a way to adjust the text within the div? Can we prevent the blue spacing after the word "text" using CSS?
If I have various texts of different lengths, is there a method to make this adjustment more universal?
.box {
border: 1px solid red;
width: 200px;
position: relative;
padding-top: 40px;
}
.label {
position: absolute;
top: -10px;
background-color: blue;
}
<h1>My First Heading</h1>
<div class="box">
I'm a box.
<div class="label">
I'm a label without a text wrapped.
</div>
</div>