Stylizing Heading Text and Borders With CSS

You want to stylize the borders on the top and bottom of a heading, as shown below:

Use the border-top and border-bottom properties when setting the style for the heading:
h2 {
font: bold italic 2em Georgia, Times, "Times New Roman", serif;
border-bottom: 2px dashed black;
border-top: 10px solid black;
margin: 0;
padding: 0.5em 0 0.5em 0;
font-size: 1em;
}
p {
margin: 0;
padding: 10px 0 0 0;
}

In addition to top and bottom borders, a block-level element also can have a border on the left and right  sides via the border-left and border-right properties, respectively. The border-top, border-bottom, border-left, and border-right properties are shorthand properties that enable developers to set the width, style, and color of each side of a border.

Vinish Kapoor

An Oracle Apex Consultant, Oracle ACE, and founder of foxinfotech.in and orclqa.com a question and answer forum for developers.