I am currently reviewing Responsive Grid CSS tutorials on YouTube. I am following the instructor's lesson, but I am facing challenges in formatting my nav grid. I have shared both the HTML and CSS code, as well as images showing the comparison between the instructor's navigation results and mine. Any assistance would be greatly appreciated.
I am attempting to create a 4-column grid for the navigation bar, but seem to be missing something crucial here.
Instructor's Navigation Results:
My Navigation Results:
/* Custom CSS Variables */
:root {
--primary: #ddd;
--dark: #333;
--light: #fff;
--shadow: 0 1px 5px rgba(104, 104, 104, 0.8);
}
html {
box-sizing: border-box;
font-family: Arial, Helvetica, san-serif;
color: var(--dark);
}
body {
background: #ccc;
margin: 30px 50px;
line-height: 1.4;
}
.btn {
background: var(--dark);
color: var(--light);
padding: 0.6rem 1.3rem;
text-decoration: none;
border: 0;
}
img {
max-width: 100%;
}
.wrapper {
display: grid;
grid-gap: 20px;
}
/* Navigation Section */
.main-nav ul {
display: grid;
grid-gap: 20px;
padding: 0px;
list-style: none;
grid-template-columns: repeat(4, 1fr);
}
<div class="wrapper">
<!-- Navigation Bar -->
<nav class="main-nav">
<ul>
<li><a href="#">Home</li>
<li><a href="#">About</li>
<li><a href="#">Services</li>
<li><a href="#">Contact</li>
</ul>
</nav>
<!-- Top Container -->
<section class="top-container">
<header class="showcase">
<h1>Delicious Food Galore</h1>
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Aliquam sem et tortor consequat id porta.
</p>
<a href="#" class="btn">Read More</a>
</header>
<div class="top-box top-box-a">
<h4>Membership</h4>
<p class="price">$199/mo</p>
<a href="" class="btn">Buy Now </a>
</div>
<div class="top-box top-box-b">
<h4>Pro Membership</h4>
<p class="price">$299/mo</p>
<a href="" class="btn">Buy Now </a>
</div>
</section>
<!-- Boxes Section -->
<section class="boxes">
<div class="box">
<i class="fas fa-pizza-slice fa-4x"></i>
<h3>Restaurants</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </p>
</div>
<div class="box">
<i class="fas fa-utensils fa-4x"></i>
<h3>Chefs</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </p>
</div>
<div class="box">
<i class="fas fa-hamburger fa-4x"></i>
<h3>Catering</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </p>
</div>
<div class="box">
<i class="fas fa-ice-cream fa-4x"></i>
<h3>Sweets</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </p>
</div>
</section>
<section>
<img src="images/dtld.jpg" alt="">
<div>
<h2> Your Business On DTLD</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<a href="#" class="btn">Learn More</a>
</div>
</section>
<!-- Portfolio Section -->
<section class="portfolio">
<img src="https:/source.unsplash.com/random/200x200" alt="">
<img src="https:/source.unsplash.com/random/201x200" alt="">
<img src="https:/source.unsplash.com/random/202x200" alt="">
<img src="https:/source.unsplash.com/random/203x200" alt="">
<img src="https:/source.unsplash.com/random/204x200" alt="">
<img src="https:/source.unsplash.com/random/205x200" alt="">
<img src="https:/source.unsplash.com/random/206x200" alt="">
<img src="https:/source.unsplash.com/random/207x200" alt="">
<img src="https:/source.unsplash.com/random/208x200" alt="">
</section>
<footer>
<p> Delicious Food Galore © 2022</p>
</footer>
</div>
<!-- End of Wrapper -->