A
A
Art2222222021-06-27 15:42:42
css
Art222222, 2021-06-27 15:42:42

How to place a link in the center (both horizontal and vertical) of a div?

60d872346f991785611220.png
I need to place a "download" link in the vertical and horizontal center of a black container.
HTML code:

<div class="up__black">
      <a class="download" href="#">Скачать</a>
</div>

CSS:
.up__black {
  width: 100vw;
  height: 10vh;
  background-color: #333;
}

.download {
  color: #fff;
  padding: 0.5vw;
  text-decoration: none;
  background-color: #333;
  border-radius: 15px;
  border: 0.5vh solid #ffe100;
}

So what do I need to do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Fezarmon, 2021-06-27
@Art222222

try display: flex;andjustify-content: center;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question