Site logo

Archived topic

Border top at H3 only

1 reply · Started by Sanu Kumar on June 28, 2021

Viewing posts 1–2 of 2

How do I add border-top (width should be less than 50%) at H3 only?
As shown in the image:
Border-Top

Hi there,

I wasn't able to find the specific heading on the screenshot but here's a sample CSS for H3 elements.

h3 {
    position: relative;
    display: inline;
}
h3:before {
    height: 3px;
    width: 20%;
    content: "";
    display: block;
    background-color: blue;
    position: absolute;
    top: 0;
    left: 0;
}

You can change the width value to the preferred fixed px value.

This archived topic is closed to new replies.