Given the HTML/CSS below, how do I make so that the width of the text below the button is, at maximum, the button's width? (see image below of the desired effect)
.button {
padding: 10px 30px;
font-size: 20px;
}
<div style="display: flex; flex-direction: column; align-items: center;">
<button class="button">
PURCHASE NOW
</button>
<p>
This is some sample text that will explain the button's functionality. I want the width of this text to be exactly the same as the button above. However, the text content of the button above is dynamic, so I cant set it's width hardcoded.
</p>
</div>
This is the desired effect, achieved manually setting the width of the paragraph (which is undesired, because the width of the button above it will have dynamic wording):