In the below snippet, notice how the paragraph element is actually wider than its wrapped content. Is it possible to make the paragraph's width to exactly equal text width? I don't want to set p width explicitly, because it needs to be responsive.
div {
width: 110px;
}
p {
background-color: #ff0;
}
<div>
<p>
asda sdzxf vzfsdf asdsdsdsddf dfsdf
</p>
</div>
edit:
So I've managed to achieve the result I've wanted. Sorry if I wasn't precise enough with my question. Here it is:
div {
background-color: #f0f;
width: 10%;
display: flex;
align-items: baseline;
}
p {
background-color: #ff0;
display: inline;
}
i {
display: inline-block;
}
<div>
<p>
asda sdzxf vzfsdf asdsdsdsddf dfsdf
</p>
<i>icon</i>
</div>