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>
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>
This should help you:
.description {
display: flex;
align-items: center;
justify-content:
}
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;
}
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>