My page seems to have right padding or margin when scaled further down?

Viewed 26

My site is fine until I go lower than 723px wide then a white margin appears on the right side of all of my background colors. I have tried to go in and delete margins and padding to see where I have gone wrong. I also played with the width of the elements and it just stretches the image over the visible portion when I set the image to full. I've inspected the page and can not define the white space on the page and where it comes from.

I also tried adding display:inline-block; to my css background divs as well as setting the width: 100%.

How the site looks on mobile iPhone SE

CSS

body {
  margin: 0;
  font-family: 'Comic Neue', sans-serif;
}

main {
  margin-top: none;
}

.hero_image {
  background-image: url("C:/Users/Kascey.Malone/Documents/Websites/Midterm/images/669.png");
  height: 100vh;
  width: 100%;
  position: relative;
  background-size: 100% 100%;
  display:inline-block;
}

/*NAVIGATION BAR*/
header {
  height: fit-content;
}

header a {
  font-weight: bold;
  color: #FCD90A;
}

header a:link {
  text-decoration: none;
}

header a:visited {
  text-decoration: none;
}

header a:hover {
  text-decoration: underline;
}

header a:active {
  text-decoration: underline;
}

.topnav {
  overflow: hidden;
  text-decoration: none;
}

.left {
  padding: 20px;
  float: left;
  width: 50%;
  box-sizing: border-box;
  text-decoration: none;
  text-align: left;
}

.right {
  padding: 20px;
  float: right;
  width: 50%;
  box-sizing: border-box;
  text-decoration: none;
  text-align: right;
}

/*HERO BOX*/
.hero {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.hero h1 {
  font-size: 15vw;
  margin: 0;
  text-align: center;
  color: #9A1000;
  font-style: italic;
}

.hero button {
  padding: 1em;
  margin-top: 10vh;
  background-color: #FCD90A;
  white-space: nowrap;
  font-size: 1vw;
  font-family: 'Comic Neue', sans-serif;
}

.hero button a{
    text-decoration: none;
    color: black;
  }

.hero button a:link {
    text-decoration: none;
  }
  
.hero button a:visited {
    text-decoration: none;
  }
  
.hero button a:hover {
    font-weight: bold;
  }
  
.hero button a:active {
    font-weight: bold;
  }

.container {
  position: relative;
}

.center {
  margin: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  -ms-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
}

/*MENU TABLE*/
.table {
  background-color: white;
  padding-top: 100px;
  padding-bottom: 100px;
  box-sizing:border-box;
}

table {
  margin-left: auto;
  margin-right: auto;
  padding: 40px;
  font-size: 1vw;
  background-color: white;
  border: solid 8px black;
  box-sizing:border-box;
}/*Add border.*/

thead {
  text-align: right;
}

td:nth-child(even) {
  text-align: left;
  padding-left: 100px;
}

td:nth-child(odd) {
  text-align: right;
  padding: 10px;
}

.row {
    display: flex;
    margin: 0 auto;
  }

table a{
    text-decoration: none;
    color: black;
  } /*Change color based off background*/

table a:link {
    text-decoration: none;
  }
  
table a:visited {
    text-decoration: none;
  }
  
table a:hover {
    text-decoration: underline;
  }
  
table a:active {
    text-decoration: underline;
  }

th {
  padding: 10px;
}
/*ABOUT TEXT*/

.about {
  height: auto;
  padding-top: 5vh;
  padding-bottom: 5vh;
  background-color: #3823FC;
  background-size: 100% 100%;
}

.column {
  flex: 50%;
  padding: 10px;
}

.column h2{
  font-size: 2vw;
  padding-left: 200px;
  color: white;
}

.column p{
    padding-right: 200px;
    padding-top: 88px;
    font-size: 1.5vw;
    color: white;
}
.column img {
    width: 30vw;
    padding-left: 200px;
    height: auto;
}


/*FOOTER*/
  .footer {
    background-color: #0C026C;
    padding: 10px;
    text-align: left;
    color: white;
  }
1 Answers

Try to use percentages for your padding/margins. Your size is scaling based on screen size with the percentages used.

Another option could be using display: flex; with flex containers.

Here is a helpful document to get you started. https://css-tricks.com/snippets/css/a-guide-to-flexbox/

You could also use @Media tags in CSS for different screen sizes to fit things manually. Here is a reference to get you started: W3 Schools Reference

Related