shortcut shortcut - 1 year ago 30
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;
  top:40px;
  left: 30px;
  width:100px;
}

https://jsfiddle.net/74zgg81d/1/

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