For some reason, my main content seems to be off to the left side while my header is to the right and my footer is where I want it to be
website in question
/* NAV BAR */
li {
font-family: "talkComic", sans-serif;
}
header {
display: flex;
height: 100vh;
width: 100%;
}
nav {
display: flex;
justify-content: space-evenly;
}
nav ul {
display: flex;
align-items: center;
gap: 100px;
list-style: none;
}
nav ul li a {
text-decoration: none;
}
.navbtn {
border-radius: 60px;
background-color: var(--periwinkle);
font-family: "talkComic", sans-serif;
color: #000;
text-align: center;
font-size: 20px;
font-style: normal;
font-weight: 400;
width: 250px;
height: 62px;
}
/* WRAPPER */
.wrapper {
max-width: 1262px;
margin: 0 auto;
position: relative;
}
/* WIP PAGE */
.wippage {
justify-items: center;
}
/* FOOTER */
footer {
background-color: var(--poopbrown);
width: 100%;
height: 200px;
color: white;
position: absolute;
bottom: 0;
}
footer a {
text-decoration: none;
color: white;
}
footer ul {
list-style: none;
}
footer h3 {
font-family: "talkComic", sans-serif;
color: var(--treegreen);
}
footer ul li {
margin: 16px 16px;
}
footer .linkscontainer {
display: grid;
grid-template-columns: 2fr 2fr 3fr;
}
footer form {
margin-left: 20px;
margin-top: 16px;
position: relative;
}
footer form input {
font-family: "talkComic", sans-serif;
font-size: 20px;
border-radius: 45px;
background: #dec0f1;
color: #000;
padding: 8px 32px;
border: none;
width: 100%;
}
footer form .submit {
position: absolute;
right: 5px;
top: 25%;
border-radius: 45px;
background: #43281c;
font-family: "talkComic", sans-serif;
border: none;
color: var(--treegreen);
cursor: pointer;
width: 133px;
height: 22px;
}
/* character list */
.charcontainer {
position: relative;
margin: 0 auto;
}
.charcontainer ul {
display: flex;
align-items: center;
gap: 100px;
list-style: none;
}
.charcontainer ul li img {
width: 303px;
height: 470px;
border-radius: 60px;
background-color: var(--treegreen);
}
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>WIP</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<header>
<div class="wrapper">
<nav>
<ul class="navbar">
<li>
<a href="#" class="navbtn">Home</a>
</li>
<li>
<a href="placeholder.html" class="navbtn">Blog</a>
</li>
<li>
<a href="index.html"><img class="logo" src="Images/sanriologo.png" alt="" /></a>
</li>
<li>
<a href="#" class="navbtn">About</a>
</li>
<li>
<a href="#" class="navbtn">Placeholder</a>
</li>
</ul>
</nav>
</div>
</header>
<div class="wrapper">
<div class="wippage">
<h2>
This page is a work in progress! <br /> Please come back later!
</h2>
</div>
</div>
<footer>
<div class="wrapper">
<div class="linkscontainer">
<div class="links">
<h3>Navigation</h3>
<ul>
<li>
<a href="#">Home</a>
</li>
<li>
<a href="#">Blog</a>
</li>
<li>
<a href="#">About</a>
</li>
</ul>
</div>
<div class="findUs">
<h3>Find Us</h3>
<ul>
<li>
<a href="#">
<img src="Images/icons/instaicon.svg" alt="" />
</a>
</li>
<li>
<a href="#"><img src="Images/icons/linkedinicon.svg" alt="" /></a>
</li>
</ul>
</div>
<div class="emailUs">
<h3>Email Us</h3>
<form action="#">
<input type="text" placeholder="Email Address" />
<button class="submit">Subscribe</button>
</form>
</div>
</div>
</div>
</footer>
</body>
</html>
I’ve tried removing the wrapper
changing the body’s padding and margin
I am a complete beginner here honestly and have no idea where I should be looking
EDIT:
I forgot to show what my body css looks like
body {
background: var(--prettypink);
margin: 0;
padding: 0;
height: 100vh;
justify-content: center;
align-items: center;
display: flex;
}
2
Answers
Try something like this
HTML
Lots of ugly borders just to show what is where.
Used grid to give the three containers a place to live.
Change the UL and LI to div and span – just my opinion that this is less hassle than fixing the style that those include etc.
put some colors on but they don’t match yours but you did not provide those so this is my 3 second guesswork
set a base 16px font on the body then used em for sizing – my brain works better with smaller numbers like say I want a size increase to 3.5X – so simple
3.5em
now if I change my base it all sizes from that.I admit I have a preference for classes kebob like
page-container
etc. I did not alter yours likenavbtn
to something likenav-button
which to me is more descriptive.note the header and footer are there and the main part takes up the rest due to the
grid-template-rows: auto 1fr auto;
I "super-centered" those three with
place-items: center;
which is a shortcut you can look up.I named the three main containers as "header", "main" and "footer" in the grid area template the put them in there.
I also leveraged the grid on your "form" in the footer in a similar way but put both the input and the button in the same grid cell – aligned the button center and put it on the right side (end)
footer form .submit { grid-area: formthing; justify-self: end;
the visual style is subjective and up to you but this is about the layout – try re-sizing the page both directions and see it should flow properly. I did NOT try on mobile
Note there is no "position" in this anywhere to make it more modern