Given the following snippet:
.btn{
border:2px solid black;
display:inline-flex;
padding:0.5rem;
max-width: 135px;
}
<a href="#" class="btn">
Vuvezelas & Reports
</a>
You can see that because of the max width on the button, the text flows onto a second line, what I would like to do is reduce the width of the button if that happens.
Like the following:
2
Answers
You can use the
white-space
property of CSS and give it anowrap
value. It will prevent the text from flowing onto the second line.CSS white-space Property
use fit-content instead of px
for more details read doc :- https://developer.mozilla.org/en-US/docs/Web/CSS/fit-content