Centrar Heading

Asked

Viewed 21 times

1

I have an Heading with bootstrap Display-4 class inside a Jumbotron and I’m not getting to center just this Heading, thank you.

<div class="jumbotron mt-5 pt-4">
    <h1 class="display-4 mx-auto" style="border-bottom: 1px solid #5C7D45 !important; display: inline-block;">Olá <?php echo $_SESSION['fName']; ?></h1>

I think there’s something of ecstatic in the code, if there is please let us know, thank you very much!

1 answer

2


Your problem is that you have to use the class text-center, to align the text in the center, and the style of the underlined vc can put in a <span> outside the text

  <link rel="stylesheet" type="text/css" media="screen" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" />

    <div class="jumbotron mt-5 pt-4">
        <h1 class="display-4 mx-auto text-center" >
          <span style="border-bottom: 1px solid #5C7D45 !important; display: inline-block;">Olá <?php echo $_SESSION['fName']; ?></span>
        </h1>
  </div>

  • Thank you very much Hugo!

  • @Afonso without problems young is the fact that spam is inside H1 does not disturb the semantics

Browser other questions tagged

You are not signed in. Login or sign up in order to post.