Custom width underline

I used to make custom underlines for websites via illustrator. Specifically when I didn’t want a full width solution. The following is an example of how to make it happen using only html/css.

To produce the follow type effect:

Add HTML element:

CSS needed: