0

I am trying to center .content class, both horizontally and vertically. Unfortunately, the logo, search bar and two buttons are sticking near the top.

I have tried adding align-items:center and justify-content: center to the .content and .middle-container class, but despite my efforts it is not moving as I would like it to.

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

body {
  height: 100vh;
  margin: 0;
  overflow: hidden;
  font-family: Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}

img {
  width: 600px;
}

button {
  font-family: Roboto, sans-serif;
  border: none;
  border-radius: 8px;
  background: #eee;
}

input {
  border: 1px solid #ddd;
  border-radius: 16px;
  padding: 8px 24px;
  width: 400px;
  margin-bottom: 16px;
}


a {
  text-decoration: none;
}

ul {
  list-style: none;
}

.header {
  display: flex;
  
}

.left-links,
.right-links {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 30px;
  padding: 10px;
}

.left-links {
  margin-right: auto;
}

.middle-container {
  display: flex;
  flex-flow: column wrap;
  align-items: center;
  justify-content: center;
  
}

.buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.footer-container {
  display: flex;
  margin-top: auto;
  
 }

.footer {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
}

.left-footer,
.right-footer {
  display: flex;
  gap: 30px;
  margin-top: auto;
  flex: 0 1 auto;
  flex-wrap: wrap;
  margin: 0;
  padding: 10px;
 }

 .left-footer{
  margin-right: auto;
 }
<div class="header">
  <ul class="left-links">
    <li><a href="#">About</a></li>
    <li><a href="#">Store</a></li>
  </ul>
  <ul class="right-links">
    <li><a href="#">Profile</a></li>
    <li><a href="#">Settings</a></li>
  </ul>
</div>
<div class="content">
  <div class="middle-container">
  <img src="./logo.png" alt="Project logo. Represents odin with the project name.">
  <div class="input">
    <input type="text">
  </div>
</div>
  <div class="buttons">
    <button>Do the thing!</button>
    <button>Do the other thing!</button>
  </div>
</div>
<div class="footer-container">
<div class="footer">
</div>
  <ul class="left-footer">
    <li><a href="#">Advertising</a></li>
    <li><a href="#">Business</a></li>
  </ul>
  <ul class="right-footer">
    <li><a href="#">Privacy</a></li>
    <li><a href="#">Terms</a></li>
  </ul>
</div>

I really appreciate your help.

Adrian Kokot
  • 2,172
  • 2
  • 5
  • 18
goose
  • 1
  • 1

0 Answers0