shortcut shortcut -4 years ago 95
HTML Question

How to center and change the length of underline?

I have text that needs to be underlined only under the middle part of the word.

I have created the fiddle and I want the underline should be centered as shown in this image.

The CSS code which I have included in the fiddle are:

.footer p
width: 50%;
border-bottom: 1px solid #f51c40;

Answer Source

It should work like you need

footer p
  width: 50%;

footer p:after {
  content: '';
  border-bottom: 2px #000 solid;
  position: absolute;
  left: 30px;

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download