azaria.dee
azaria.dee

Reputation: 83

Trouble with making my website responsive

I am currently attempting to make my website responsive i.e. images scale up and down with page resizing, content stacks above each other, etc. I was under the impression that I had taken the appropriate steps, but the elements are still stretching in size when resizing and the contents are not staying in their original positions.

How can I achieve this result while keeping all of my elements intact?

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-image: url(img/food-background.jpg);
  background-attachment: fixed;
  height: 100%;
}

.main-content {
  display: flex;
  flex-wrap: wrap;
}

.container {
  margin-left: auto;
  margin-right: auto;
  width: 1140px;
}

.Navbar {
  text-align: center;
  display: block;
  margin-top: 2%;
}

#center-logo {
  width: 100%;
  max-width: 200px;
  height: auto;
  text-align: center;
}

#Navbar_Link-Toggle {
  display: none;
}

img {
  width: 40%;
}

.links {
  text-decoration: none;
  font-size: 13px;
  color: black;
  font-weight: bold;
  padding: 25px;
}

.links:hover {
  color: #f58300
}

a:visited {
  color: black;
}

.header {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 3%;
  height: auto;
  background-color: yellow;
}

#food {
  height: 65vh;
  width: 100%
}

.footer {
  margin-top: 100%;
  bottom: 0;
  width: 100%;
  text-align: center;
  font-size: 10px;
  margin-left: auto;
  margin-right: auto;
  background-color: #f7f7f7;
}

.top {
  float: left;
  width: 100%;
}

#olive-green {
  margin-top: 5%;
  position: absolute;
  right: 50px;
  max-width: 450px;
}

#coral {
  max-width: 450px;
  position: absolute;
  left: 50px;
  margin-top: 5%;
}

#teal {
  max-width: 450px;
  position: absolute;
  left: 50px;
  margin-top: 50%;
}

#honey {
  margin-top: 50%;
  position: absolute;
  right: 50px;
  max-width: 450px;
}

.images {
  content: "";
  clear: both;
  display: table;
}

@media screen and (max-width: 900px) {
  .top {
    width: 100%;
  }
  .bottom {
    width: 100%;
  }
}
<div class='main-content'></div>

<div id='Navbar_Link-Toggle' style='font-size: 20px'>

  <i id='main' class='fas fa-bars'></i>

</div>

<div class='container'>

  <div class='Navbar'>

    <a class='links' href=''>FOOD</a>

    <a class='links' href=''>FUN</a>

    <img id='center-logo' src='img/SAMO.png'>

    <a class='links' href=''>HISTORY</a>

    <a class='links' href=''>LOCATION</a>

  </div>

</div>

<div class='header'>

  <img id='food' src='img/food.jpg'>

</div>

<div class='images'>

  <div class='top'>

    <img id='coral' src='img/coral.png'>

    <img id='olive-green' src='img/olive-green.jpg'>

  </div>

  <div class='middle'>

    <img id='teal' src='img/teal.jpg'>

    <img id='honey' src='img/honey.jpg'>

  </div>

</div>

</div>

<div class='footer'>

  <p>200 Santa Monica Pier, Suite A Santa Monica, CA 90401</p><br>

  <p>Questions? Drop us a message at: [email protected] or 310-458-8900</p><br>

  <p>All Rights Reserved © 2019 Santa Monica Pier</p>

</div>

Upvotes: 0

Views: 57

Answers (1)

Apotheosis
Apotheosis

Reputation: 131

You have an extra closing div on the first line of your HTML. So your .main-content element is actually being closed right away instead of wrapping around the rest of the elements.

Upvotes: 1

Related Questions