Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8849277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:36:30+00:00 2026-06-14T12:36:30+00:00

I am trying to use the <hr> tag to style and include different headings

  • 0

I am trying to use the <hr> tag to style and include different headings for parts of my website. I am using CSS pseudo elements to add the heading text to the <hr> element.

My HTML looks like:

<div id="steps">
    <div id="step1"><hr class="stepheading">contentcontent</div>
    <div id="step2"><hr class="stepheading">contentcontent</div>
    <div id="step3"><hr class="stepheading">contentcontent</div>
    <div id="step4"><hr class="stepheading">contentcontent</div>
</div>

My CSS looks like:

hr.stepheading{
    padding: 0;
    border: none;
    border-top: medium double #333;
    text-align: center;
    color: #333;
    margin: 130px 0px;
}

hr.stepheading:after{
    content: "The First Step";
    position: relative;
    top: -0.7em;
    display: inline-block; 
    padding: 0 0.25em;
    background: white;
}

So, I can see that the problem is that every single one of my headings will contain “The First Step” instead of other headings for other steps.

Demo

I want each heading to have a different title: “The First Step,” “The Second Step,” etc…

How do I go about doing that and what technology do I use? Can this be done in purely HTML and CSS or do I have to use Javascript/JQuery to achieve what I want?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T12:36:31+00:00Added an answer on June 14, 2026 at 12:36 pm

    Use nth-child() on the div element:

    hr.stepheading:after{
        content: "The First Step";
        position: relative;
        top: -0.7em;
        display: inline-block; 
        /* Other details */
    }
    
    div:nth-child(2) hr.stepheading:after{
        content: "The Second Step";
    }
    div:nth-child(3) hr.stepheading:after{
        content: "The Third Step";
    }
    div:nth-child(4) hr.stepheading:after{
        content: "The Fourth Step";
    }​
    ​
    

    Demo: http://jsfiddle.net/bQBgL/4/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using CSS, I'm trying to specify the height of a span tag in Firefox,
I am trying got use spring-mvc tag inside java-script file, here is what i
I'm trying to use mezzanine's overextends tag to both override and extends the existing
I am trying to use the <see> tag in C#'s XML documentation. The problem
I am trying to use Cookie so that a default style OR a specific
I am trying to use a tooltip in css, it is working, but I
I'm very new to programming and I am trying to use paperclip to add
I am trying to learn how to use Cascadding Style Sheets. I have a
I'm trying to change the display CSS property of a <div> tag when the
well right now im trying to learn how to use the canvas tag on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.