Search code examples
htmlcsscenter

Center (Circle) Div in Footer


I have a Circle Div in my Footer and want to Center it into the Footer. At the End there will be 3 Circles in a Row. How it looks My CSS:

.circle {
  height: 50px;
  width: 50px;
  background-color: rgba(0, 0, 0, 0.90);
  border-radius: 50%;
  text-align: center;
  font-size: 30px;
}

footer {
  text-align: center;
  position: fixed;
  bottom: 0;
  width: 100%;
  background-color: green;
}


Solution

  • You can use display:flex and align-items & justify-content to align it both vertically and horizontally.

    body, html {
      padding: 0;
      margin: 0;
    }
    footer {
      width: 100%;
      background-color: #dedede;
      border-radius: 5px;
      padding: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .circle {
      border-radius: 50%;
      width: 40px;
      height: 40px;
      background-color: black;
    }
    <footer>
    <div class="circle"></div>
    </footer>