1

How can I center the description in the main block? I tried to use {margin: auto} or {margin-left:auto, margin-right:auto}, but it does not helps.

<main class="row">
  <div class="description">A little description</div>
</main>

3 Answers3

0

This should help you:

.description {
display: flex;
align-items: center;
justify-content:    
}
0

You need to tell the description-<div> to be inline-block, otherwise it will stay there. Try it with this entry in your stylesheet:

.description {
  display: inline-block;
  text-align: center;
}
0

If you are using Bootstrap 4 then use mx auto.

<head>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
    </head>
    <body>
<main class="row">
  <div class="description mx-auto">A little description</div>
</main>
</body>

Otherwise

.description {
  text-align:center;
}
 <main class="row">
      <div class="description">A little description</div>
    </main>
Amer Riaz
  • 44
  • 4