skip to Main Content

I am building a website in Html and CSS. Currently I have a small problem where I am struggling to place a border below text like in the image below. Here’s my code in Html

<div class="Sectionheading">
     <h1>LegalPractice Area</h1>
</div>

enter image description here

2

Answers


  1. You can use the horizontal row tag to get the output you are looking for:

    <hr style="width:10%;text-align:center">
    

    For reference check this page out: https://www.w3schools.com/tags/tag_hr.asp

    Login or Signup to reply.
  2. Try this:

    .Sectionheading{
        text-align:center;
    }
    h1{
        padding-bottom: 25px;
        position:relative;
    }
    h1:before {
        content: " ";
        width: 60px;
        height: 5px;
        position: absolute;
        margin: 0 auto;
        left: 0;
        right: 0;
        bottom: 0;
        background: #ff9700;
    }
    <div class="Sectionheading">
         <h1>LegalPractice Area</h1>
    </div>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search