I assume you are using an inline-block element because you have tagged your question with it. All inline-block elements can be sized to fit their container with the following:
width: 100%;
That's it!
Add a border to the bottom and you're good to go:
border-bottom: 1px solid black;