Grid alignment issue

Tell us what’s happening:
I cannot align my grid regardless of how I set up the .projects-grid {
} section of my code.

Can anyone find what I m doing wrong or provide advice on how I can fix this?
Thanks for any advice given on this matter.

  **Your code so far**
/* file: index.html */
<!DOCTYPE html>
<html>
<main>
  <meta charset="UTF-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>Personal Portfolio Webpage</title>
  <link rel="stylesheet" href="styles.css"/>
  </main>
  <body>
    <nav id="navbar">
      <ul class="nav-list">
      <li><a href="#welcome-section">Top of Page</a><li>
    <li><a href="#projects">About</a></li>
      <li><a href="">Bottom of Page </a></li>
      </ul>
      </nav>
<section id="welcome-section" class="welcome-section">
<h1> Hey I am Corey</h1>
<p>This is a portfolio page I coded</p>
</section>
<section id="projects" class="projects-section">
  <h2> Projects I am working on </h2>
    <div class="projects-grid">
      <a class="project project-tile"></a>
      <a class="project project-tile" href="" target="_blank">
<img class="project-image" src="https://socialistmodernism.com/wp-content/uploads/2017/07/placeholder-image.png?w=640" alt="placeholder image"/>
<p class="project-title">
This is for link one
</p>
      </a>
      <a class="project project-tile" href="" target="_blank">
<img class="project-image" src="https://socialistmodernism.com/wp-content/uploads/2017/07/placeholder-image.png?w=640" alt="placeholder image"/>
<p class="project-title">
This is for link two
</p>
      </a>
      <a class="project project-tile" href="" target="_blank">
<img class="project-image" src="https://socialistmodernism.com/wp-content/uploads/2017/07/placeholder-image.png?w=640" alt="placeholder image"/>
<p class="project-title">
this is for link 3
</p>
      </a>
      <a class="project project-tile" href="" target="_blank">
<img class="project-image" src="https://socialistmodernism.com/wp-content/uploads/2017/07/placeholder-image.png?w=640" alt="placeholder image"/>
<p class="project-title">
this is for link 4
</p>
      </a>
      </div>
</section>

    </body>
</html>
/* file: styles.css */
:root {
--main-gray: rgb(100, 100, 100);
--main-white: rgb(235, 235, 235);
--main-aqua: rgb( 0, 255, 255);
}

* {
margin: 0;
}

body {
font-size: 1.2rem;
   font-family: "poppins", sans-serif;
   font-weight: 400;
   margin-right: 1rem;
background-color: var(--main-gray);
}



#navbar {
top: 0;
left: 0;
margin: 0;
padding: 1.2rem;
display: block;
justify-content: flex-end;
position: fixed;
box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
background-color: rgb(200, 150, 150);
width: 100%;
z-index: 8;
}
#navbar a:hover {
background-color: var(--main-gray);
}

ul {
list-style: none;
float: right;
display: flex;      
}

a {
text-decoration: none;
padding: 1.2rem;
color: var(--main-white);
text-shadow: 0 1px var(--main-gray);
}

#welcome-section {
margin: 0;
display: flex;
flex-direction: column;
justify-content: center;
width: 100%;
height: 80vh;
align-items: center; 
}

h1, h2 {
font-weight: 700;
font-family: Raleway;
text-align: center;
}
h1 {
margin: 0;
font-size: 4rem;
background: -webkit-linear-gradient(var(--main-white), var(--main-aqua));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}

#welcome-section p {
font-size: 1.5rem;
color: var(--main-aqua);
text-shadow: 0 1px black;
}

.projects-section {
padding: 8rem 2rem;
background-color: #A7BBCB;
}

h2 {
margin: 0 auto 6rem auto;
color: var(--main-white);
text-shadow: 0 1px black;
font-size: 2.2rem;
border-bottom: 0.1rem solid var(--main-gray);
max-width: 400px;
}
.projects-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
grid-gap: 2rem;
width: 100%;
max-width: 1280px;
margin: 0 auto;
}

.projects-grid a {
border: solid
}

  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0

Challenge: Build a Personal Portfolio Webpage

Link to the challenge:

Nevermind, it figured it out by adding an object-fit: cover; and width: 100%;
for the project image class.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.