The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Center horizontal line

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #280953

    Good day,

    I am trying to center a small horizontal line under my text, but in some way it does not end up centered. My guess it has something to do with different type of header. I am using beaver builder and when I click on the horizontal line it says it is a different header then the header i am using H2, is there a way to style the HR in the same style as header 2?

    thanks for your time




    First issue… I haven’t a clue what beaver builder is and I’m not sure that the regulars here will either. We’re the kind of folks who write and work with code from the ground up, so we can advise on HTML, CSS or whatever, but we’re unlikely to know how beaver builder fits in to things, or it’s capabilities.

    Second issue… We can’t diagnose an image; we’d need to see the associated code to be able to suggest how to centre it. You can provide the necessary HTML and CSS in a much reduced CodePen demo. Note that we don’t need your whole codebase (or a link to a live website); we just need a very small sample to illustrate the problem specifically noted here. You can use the developer toolbar (F12) to inspect the problem element and extract the pertinent markup and styles from your live website.


    Hi thanks for your help,

    see the css code below

    h2 style=”text-align: center;”>TEST

    hr style=”width: 5%;” />


    A CodePen demo please… we need the HTML and CSS that applies to those elements and we need to see it showing the actual problem. Making an observation from what’s provided, there is nothing to suggest you’ve tried to centre the hr in those inline styles — maybe try autoing the left and right margins? — but we don’t know what other CSS is in play in order to suggest anything useful. Please use the developer toolbar to extract the relevant code from what you see when viewing your live website – that’s F12 in most browsers. Unfortunately, guessing wastes our time as well as yours, and folks won’t mock up loosely relevant demos for you because there’s a good chance they won’t work as expected. We need to see your code. Help us to help you.

    General help: try Googling “how to center an element with CSS” and try some of the code you find on your travels.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.