Display block without 100% width
Use display: table
.
This answer must be at least 30 characters; I entered 20, so here's a few more.
If I'm understanding your question properly, the following CSS will float your a below the spans and keep it from having a 100% width:
a {
display: block;
float: left;
clear: left;
}
you can use:
width: max-content;
Note: support is limited, check here for a full breakdown of supporting browsers