How to Set Relative Border-Bottom Style in CSS.

In this article, we shall learn how to set relative border-bottom style in the Cascading Style Sheets language.

Here is an example of how you can create nice border with HTML and CSS.

The Code for h2, h3 and h4 selectors

h2::after, h3::after, h4::after {

content: “”; /* This is necessary for the pseudo element to work. */

display: block; /* This will put the pseudo element on its own line. */

width: 100px; /* Change this to whatever width you want. */

padding-top: 20px; /* This creates some space between the element and the border. */

border-bottom: 4px solid #feb633; /* This creates the border. You can replace the color with the one you want. */


CSS code example

The Result

Image of border-bottom style for heading tag in html

You can learn more by following my social media:

Support my blog by this link:

Schedule a Call

Posted by Edgar Hovhannisyan


Your email address will not be published. Required fields are marked *